0

我正在从可扩展列表的 getChildView 方法启动一个 ListActivity。

public void onClick(View v) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage("Do you want see all vendors selling this item?");
    builder.setCancelable(false);
    builder.setPositiveButton("Yes",
        new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                Intent intent = new Intent(context, SellerListActivity.class);
                intent.putExtra("category", laptop);
                context.startActivity(intent); 

            }
    });
}

ListAcitivity 类 onCreate 如下所示:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_seller_list);

    String[] from = { "name", "phone" };
    int[] to = {android.R.id.text1, android.R.id.text2 };

    adapter = new SimpleAdapter(SellerListActivity.this, sellerList,
            android.R.layout.simple_list_item_2, from, to);


    SellerListActivity.this.setListAdapter(adapter);

    /*Go and fetch the sellers*/
    new RetrieveContactsAll().execute();
}

RetrieveContactsAll 是具有以下 onPostExecute 函数的 AsyncTask

protected void onPostExecute(ArrayList<Map<String, String>> sellerList) {
    adapter.notifyDataSetChanged();
    pDialog.dismiss();
} 

问题是,当我单击可扩展列表子项时,我看到列表视图已填充并在它消失之前短暂显示并被可扩展列表替换。

4

0 回答 0