我正在从可扩展列表的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();
}
问题在于,当我点击可扩展列表子项时,我看到列表视图已填充并在它消失之前暂时显示,并被可扩展列表替换。