开发者

Retrieve a value of a specified line in a ListView

开发者 https://www.devze.com 2023-03-28 20:37 出处:网络
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 r

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消