How to retrieve the clicked string from a listview using OnItemClick?

前端 未结 4 2231
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 06:48

I\'ve got some problem here. It looks simple and i keep searching for its solution. Unfortunately, i cant find anything. This is my problem.... What i\'m trying to do is to

4条回答
  •  春和景丽
    2020-12-31 07:21

    arg0 is your AdapterView, typically a ListView. arg2 is the position in the ListView. You can get the items from your Adapter :

    Object item = arg0.getItemAtPosition(arg2);
    

    Depending on the type of your object in your adapter, a trivial solution is:

    String value = item.toString();
    

提交回复
热议问题