SimpleCursorTreeAdapter
を使用して、正しいグループ犯人と子どもを持つExpandableListView
を作成できます。私のプログラムでは、各子供に3つのTextView
が含まれています。グループを展開して子をクリックすると、カスタムダイアログを使用してEditText
ビューの3つの値を表示します。クリックしたグループのchildcursorで正しい値を取得
"ONE"グループを一度に1つだけ開いても問題ありません。私は、クリックすると正しい子値を得ることができます。しかし、私は同時にいくつかのグループを展開する場合。最新のグループの最新の子のみを表示します。
例:グループAには3つの項目、グループBには5つの項目、グループCには2つの項目があります。最初にグループAの子どもをクリックしても問題ありませんでしたが、グループBの子どもは問題ありませんでしたが、グループAの子をクリックして戻っても、グループBの子はまだ表示されています。子供。私がToastを使って表示すると、すべての子供は正しいので、奇妙です。この方法では何ができますか?
epView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener()
{
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long row)
{
return false;
}
});
epView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
int tempid = childcursor.getInt(0);
String temp1 = childcursor.getString(1);
String temp2 = childcursor.getString(2);
String temp3 = childcursor.getString(3);
CustomDialog custom = new CustomDialog(ListCateActivity.this,catecursor,childcursor,temp1,temp2,temp3,tempid);
custom.setTitle("Record Information");
custom.show();
Toast.makeText(ListCateActivity.this, "Group:"+String.valueOf(groupPosition).toString()+" Child: "+String.valueOf(childPosition).toString()+temp1+" "+temp2+" "+temp3, Toast.LENGTH_SHORT).show();
return true;
}
});
ありがとうございます!
私は似たようなことをしています。http://stackoverflow.com/questions/10611927/simplecursortreeadapter-and-cursorloader – toobsco42