I have defined a custom view (xml) for my ArrayAdapter
for a ListView
, which adds a Button
. I'd like to create an OnClickListener
for this Button
per row, but without creating a custom adapter. Is that possible, or does Android force me to create a custom ArrayAdapter
for my ListView
?
Here's a snippet of what I'm doing:
glAdapter = new ArrayAdapter<Group>(getActivity(), R.layout.fragment_grouprow, R.id.groupRowText, ListOfGroups); ListView groupListView = (ListView)mainView.findViewById(R.id.listViewGroupMain); groupListView.setAdapter(glAdapter); groupListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Call function } });
Now I'd like to add an OnClickListener
for the Button
in my custom view.
Thanks in advance,
Lali
getview
. its better to have a custom adapter – Raghunandan Jul 9 '13 at 10:01