I am using one class which extends ListActivity and One class extending BaseAdapter. The Base Adapter uses getView function to inflate lay开发者_StackOverflow中文版out from xml. The xml contains a text and a button to delete the row of list. Please let me know how to handle the button click in the ListActivity class. Send me a sample snapshot Thanks
just create an on click listener for the item that you want to in your get view.
For instance
public class FooAdapter extends ArrayAdapter<T>
////stuff
public View getView(int position, View convertView, ViewGroup parent)
{
list.get(position)
Button b = (Button)findViewById(R.id.button)
b.setOnClickListener(l)//l is a View.OnClickListener type
}
that will render a listener for each button in the view
精彩评论