How Communicate Between Adapter And Activity
I'm not sure what's the best way to communicate from an Adapter to the corresponding Activity. My activity has a layout with a WebView and a Gallery on top of it:
Solution 1:
Instead creating Imageview's click listener, use gallery's setOnItemClickListener
yourGallery.setOnItemClickListener(new OnItemClickListener()
{
@Override
publicvoidonItemClick(AdapterView<?> arg0, View arg1,int position, long arg3) {
system.out.println("position"+position);
}
});
Solution 2:
Use the setOnItemClickListener
method of your Gallery object in the activity.
Post a Comment for "How Communicate Between Adapter And Activity"