I am creating a list. List items are retrieved from the sqlite database .. I populate the list using ArrayList and ArrayAdapter ... after clicking on the items in the list, I want to be able to run an intent containing information about the item clicked ... the information resembles the index number of the item.
using method: onItemClick (AdapterView av, View v, int index, long arg)
I get the index of the item clicked. however, it appears in the list. The problem occurs when I set setFilterTextEnabled (true), and in the application type - in some text to look for some element .. and then click on it. Instead of specifying the index of the item in the source list, it gives me the index in the filtered list.
The following is a snippet of code:
myListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> av, View v, int index, long arg) { Intent lyricsViewIntent = new Intent(iginga.this, LyricsPage.class); lyricsViewIntent.putExtra("title", songList.get((int)arg).getTitle()); lyricsViewIntent.putExtra("id", songList.get((int)arg).getSongId()); startActivity(lyricsViewIntent); } }); myListView.setTextFilterEnabled(true);
Is there a way to get the source index / position of the element instead of the one that appears in the filtered text ... when filtering.
source share