Retrieve a value of a specified line in a ListView
I have a ListView 开发者_JAVA百科that is displaying data stored in a file, normally, we can also delete a line (data) from this ListView. The file's datas are stored within another class. i want to retreive value1
(public) variable of a specified line in the ListView before deleting it(please see code). Can i specify value1
of arg2
line of the ListView ?
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
Carburant m= new Carburant(); //instanciate the class that contains the value1 variable
String value1= m.value1; //here i want to store value1 variable of arg2 line in the ListView
list.remove(arg2); //here all the line (data) will be deleted
Thank you for helping.
listeView.getItem(index);
You can get the index from onClick.
精彩评论