Listactivity.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:ImapNote2 作者:
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

// Accounts spinner
this.accountSpinner = (Spinner) findViewById(R.id.accountSpinner);
Listactivity.currentList = new ArrayList<String>();
// Spinner item selection Listener
this.accountSpinner.setOnItemSelectedListener(this);

imapNotes2Account = new ImapNotes2Account();
Listactivity.accountManager = AccountManager.get(getApplicationContext());
Listactivity.accountManager.addOnAccountsUpdatedListener((OnAccountsUpdateListener)
    new AccountsUpdateListener(), null, true);

status = (TextView)findViewById(R.id.status);

this.spinnerList = new ArrayAdapter<String>
    (this, android.R.layout.simple_spinner_item,Listactivity.currentList);
spinnerList.setDropDownViewResource
    (android.R.layout.simple_spinner_dropdown_item);
this.accountSpinner.setAdapter(spinnerList);

this.noteList = new ArrayList<OneNote>();
((ImapNotes2)this.getApplicationContext()).SetNotesList(this.noteList);
this.listToView = new NotesListAdapter(
    getApplicationContext(),
    this.noteList,
    R.layout.note_element,
    new String[]{"title","date"},
    new int[]{R.id.noteTitle, R.id.noteInformation});
listview = (ListView) findViewById(R.id.notesList);
listview.setAdapter(this.listToView);

listview.setTextFilterEnabled(true);

this.imapFolder = new Imaper();
((ImapNotes2)this.getApplicationContext()).SetImaper(this.imapFolder);

if (Listactivity.storedNotes == null)
    storedNotes = new NotesDb(getApplicationContext());

// When item is clicked, we go to NoteDetailActivity
listview.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> arg0, View widget, int selectedNote, long arg3) {
        Intent toDetail = new Intent(widget.getContext(), NoteDetailActivity.class);
        toDetail.putExtra("selectedNote", (OneNote)arg0.getItemAtPosition(selectedNote));
        toDetail.putExtra("useSticky", Listactivity.imapNotes2Account.GetUsesticky());
        startActivityForResult(toDetail,SEE_DETAIL); 
    }
  });

  editAccountButton = (Button) findViewById(R.id.editAccountButton);
  editAccountButton.setOnClickListener(clickListenerEditAccount);

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号