Hi everyone,
I have created a ListView and a custom Adapter with ImageButton widget
in each row. I set the ImageButton OnClick Listener in getView method
to trigger each ImageButton's OnClick event of each ListView row.
Everything goes well, but I have no idea how to call Activity methods
from ImageButtons' OnClickListener handler.
I initial my ListView as following code
in MyActivity class:
protected void onCreate(Bundle savedInstanceState) {
MyListAdapter myListAdapter = new MyListAdapter
( MyActivity.this,
R.layout.list_row,
myList );
myListView.setAdapter(myListAdapter);
}
in MyListAdapter class:
public View getView(int position, View convertView, ViewGroup parent)
{
LayoutInflater inflate = LayoutInflater.from( context );
View v = inflate.inflate( rowResID, parent, false);
ImageButton button1 = (ImageButton)v.findViewById( R.id.button1 );
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
//How to call MyActivity class methods from
here??
}
});
}
Thank you for your kindly help in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---