我有一个非常简单的问题。在包含可扩展列表视图的对话框中,当我单击一个孩子时,我想做一些操作并返回到活动。setOnChildClickListener()
我的和的点击事件setOnGroupClickListener()
都在工作,但我的警报对话框没有关闭。我想在单击列表时关闭我的警报对话框并返回到我的活动。任何人都可以帮忙吗?
代码:
final AlertDialog.Builder builder = new AlertDialog.Builder(
TestActivity.this);
ExpandableListView dialogExpandableListView = new ExpandableListView(
this);
dialogExpandableListView
.setAdapter(new EfficienctExpandableAdapter(
this));
dialogExpandableListView
.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView arg0,
View arg1, int arg2, int arg3, long arg4) {
// TODO Auto-generated method stub
Log.d("skt", "clicked parent " + arg2 + " child "
+ arg3);
return false;
}
});
dialogExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Log.d("skt", "group click --- clicked parent " + arg2);
return false;
}
});
builder.setView(dialogExpandableListView);
builder.create();
builder.show();