I have a ListView
and on row click I show AlertDialog
with data about selected element.
ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE, "Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// I need to access 'i' here somehow?
}});
My AlertDialog
have action button and here I need data from selected element.
But inside event function for alert button I can't access data i
and l
from outside function.
Is there some way to access it or it should be passed somehow?
// I need to access 'i' here somehow? i should final
public void onItemClick(final AdapterView adapterView, View view, final int i, long l) adapterView.getAdapter().getItem(i)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.