我有一个扩展的列表视图,在父节点和子项目中都有复选框.
所有数据都来自Web服务,因此它的动态.
附图:
现在在菜单项上单击我想要获取所有复选框状态.
请指导我如何获得其中使用的复选框的ID.
代码附:
/**
*
*/
public class Object_SecurityActivity extends ExpandableListActivity {
@Override
public boolean onChildClick(ExpandableListView parent,View v,int groupPosition,int childPosition,long id) {
// TODO Auto-generated method stub
return super.onChildClick(parent,v,groupPosition,childPosition,id);
}
@Override
public void onContentChanged() {
// TODO Auto-generated method stub
super.onContentChanged();
}
private AndroidClientEntity obj_android_client;
private static final String LOG_TAG = "ElistCBox2";
private String username,password,clientname;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
//setContentView(R.layout.main);
Intent security_intent = getIntent();
String id = security_intent.getStringExtra("id");
obj_android_client = (AndroidClientEntity) getApplicationContext();
username = obj_android_client.getUsername();
password = obj_android_client.getPassword();
clientname = obj_android_client.getClientName();
new Securityasync().execute(username,clientname,id);
}
class Securityasync extends AsyncTask
和适配器类:
public class Expandable_list_Adapter extends BaseExpandableListAdapter implements OnCheckedChangeListener {
private Context context;
private ArrayList
Child.xml
parent.xml与child相同.
请指导我如何获得复选框的ID,因为在选择的菜单项上我必须对此进行操作基础知识.
编辑:我试着setTag()和getTag().但现在可扩展列表视图显示出奇怪的行为.当我选择一个复选框并展开另一个组时,所有chekbok框都设置为默认值.
在这种情况下我必须做什么.我不知道resion为什么不保存状态.
我正面临与Strange behaviour in Expandablelistview – Android相同的问题
Plz指南