How to get the value of a Listview item which is clicked in android?

前端 未结 4 757
情话喂你
情话喂你 2020-12-15 11:05

I have this below code access the ListView item value into string and display it in alert?

ListView shot = getListView();
shot.setOnItemClickListener(this);
         


        
4条回答
  •  旧巷少年郎
    2020-12-15 11:26

    Maybe you can try this

    String data = (String)shot.getItemAtPosition(arg2);
    AlertDialog.Builder adb = new AlertDialog.Builder(arg1.getContext());              
    adb.setMessage(data).show();
    

提交回复
热议问题