i want to make a dynamic list with buttons on it. My button in XML looks like this:
<Button
android:id="@+id/list_with_button_button"
android:layout_width="60dp"
android:layout_height="60dp"
android:onClick="extraClick"
android:text="Extra" />
and in my programm i use this
public void extraClick(View v){
v.getPosition?
}
i create the list with this
String[] from = new String[]{"name","price","description"};
int[] to = new int[]{R.id.name,R.id.price, R.id.description};
SimpleAdapter layoutAdapter = new SimpleAdapter(this, currentValues, R.layout.bestellbuttonlist, from, to);
how can i get the position from the liste where the button is clicked when i only got the View v?
Thank you
While inflating the button into your ListView in you
getView()method,You can
setTagto that Button like,and in
onClickevent, you can get that tag like,Here is one EXAMPLE LINK for the same.