|
。。。。。
private Dialog dialogM;
。。。。。。
showDialog(0);
。。。。
@Override
protected Dialog onCreateDialog(int id) {
if(id==0)
{
ListView listView = new ListView(this);
listView.setAdapter((ListAdapter) FileManager.getAdapter(this, listView, path));
listView.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
LinearLayout ll = (LinearLayout) arg1;
// 获取其中的TextView
TextView typeview = (TextView) ll.getChildAt(3);
if (typeview != null &&"0".equals(typeview.getText())) {
TextView pathview = (TextView) ll.getChildAt(2);
path = pathview.getText().toString();
dialogM.cancel();
}
else if(typeview != null &&"1".equals(typeview.getText()))
{
TextView pathview = (TextView) ll.getChildAt(2);
path = pathview.getText().toString();
dialogM.dismiss();
showDialog(0);
}
}
});
dialogM= new AlertDialog.Builder(this).setTitle("xx").setView(listView).create();
return dialogM;
}
return super.onCreateDialog(id);
}
创建了dialog后 不管调用cancel()还是dismiss(),再次调用showDialog(0)时不进入onCreateDialog()方法。显示的内容还是之前的内容,本来是一个文件目录显示的dialog,要重新根据path查找目录下的目录和文件显示的。 |
|