I'm working on an app and in that app I've created a custom listview. I am populating the listView from an API call.Now on the click of a perticular list item i want to get the data which is shown on that index. What shall i change in the below code
  vehicle_select_listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ImageView selectedImage = (ImageView) view.findViewById(R.id.checkBox);
           selectedImage.setImageResource(R.drawable.simplecheck);
           String str =  parent.getAdapter().getItem(position).toString();
            Toast.makeText(getApplicationContext(), "  " + str , Toast.LENGTH_SHORT).show();
        }
    });
}
Please help. Thank you
Simple as that. parent.getItemAtPosition(position);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With