Toast not generating text from selected item from list

后端 未结 5 2079
抹茶落季
抹茶落季 2021-01-25 17:42

I\'ve made a simple app in android with list View,In that i want to make a toast when select an item,i have tried as below but its not working..

my code is as below:

5条回答
  •  Happy的楠姐
    2021-01-25 18:22

    You can take the adapter and take value from it.

    public void onItemClick(AdapterView arg0, View arg1, int position, long arg3) 
                String selectedValue =(String) (lv.getAdapter().getItem(position));
                Toast.makeText(getApplicationContext(),Toast.LENGTH_LONG).show();
            }
    

提交回复
热议问题