Example #1
0
 @Override
 public void handleMessage(Message msg) {
   if (msg.what == 0) {
     adapter.notifyDataSetChanged();
     listView.doneRefresh();
     Toast.makeText(TestMailList.this, "正在加载" + msg.arg1 + "...", Toast.LENGTH_LONG).show();
   } else if (msg.what == 1) {
     adapter.notifyDataSetChanged();
     listView.doneMore();
   } else {
     super.handleMessage(msg);
   }
 }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.mail_inbox);
    listView = (MailListView) findViewById(R.id.mail_list);
    // listView=new MailListView(this);
    data = new ArrayList<String>();
    for (int i = 0; i < 10; i++) {
      data.add(" this is " + i);
    }
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, data);
    listView.setAdapter(adapter);
    listView.setDoMoreWhenBottom(false);
    listView.setOnRefreshListener(this);
    listView.setOnMoreListener(this);
  }