For accessing items from a base adapter in Main activity
First Step:
1: Clickable = false in all custom components (eg in list item)
2: Focusable= false,Focusable in touch mode = false in custom items.
Step 2:
Suppose if we are using gridview,make it clickable= true
then on gridview item click listener,access the components in custom adapter using view object
eg:
gViewImages.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent,
View vi, final int position, long id) {
CheckBox cBox = (CheckBox) vi.findViewById(R.id.cbSelectImage);
System.out.println("asjdhsajghasjhdsaf"+cBox.getId());
cBox.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
System.out.println("Check box clicked ---position is "+position);
System.out.println("Image link is "+imgAdapter.mList.get(position).imageLink);
}
});
}
});
0 comments: