onItemClick gives index/ positi on of item on visible page 鈥?not actual index of the item in list ..problem on enabling setTextFilterEnabled ..

by Abhinav » Sat, 27 Mar 2010 07:10:44 GMT


Sponsored Links
 hi,

I am creating a list .. the elements of the list are drawn from sqlite
database .. I populate the list using ArrayList and
ArrayAdapter ...upon clicking the items on the list I want to be able
to fire an intent containing info about the item clicked ... info like
the index number of the item ..

using the method : onItemClick(AdapterView av, View v, int index, long
arg)

I do get index of the item clicked . however it is of the list
currently displayed . the problem comes when I do
setFilterTextEnabled(true) , and on the app type in some text to to
search some item ..and then click it ..rather than giving me the index
of the item on the original list it gives me the index on filtered
list..

following is the snippet of code:
-----------------------------------------------------------------
x--------------------------x-----------------
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);
----------------x---------------------------------------------------
x-------------------------------------

Is there any way I can get the original index /position of the item
instead of the one showing in filtered text ...when filtered.

--



Other Threads

1. Develop Software or Systems? Earn Guaranteed $10 or have $10 donated to FIRST; Chance to Win an iPad 2

VDC Research is conducting its annual survey of embedded engineers,
and if you are involved in the engineering of mobile or embedded
systems/software, this is your chance to influence key embedded
solution suppliers. The research covers embedded software, hardware,
tools, and development practices and of particular importance to VDC
this year is the development of Android-based devices.

In appreciation of your participation -

The first 400 respondents who complete the survey will receive:
-Choice of a $10 Amazon.com gift certificate or elect to make a $10
donation to FIRST (a charitable organization helping to promote the
sciences to the next generation of engineers and developers).

All respondents (including the first 400) who complete the survey will
receive:
-Entry into the grand prize drawing for an Apple iPad 2;
-Immediate access to a summary of VDC's 2010 Embedded Engineering
Survey results at the end of the survey; and
-A summary of the 2011 Embedded Engineering survey findings once the
survey is complete later this year.


To begin the survey, go to: http://bit.ly/gs5eGG


Thank you very much for your assistance.


Best Regards,

The VDC Embedded Software and Tools Research Team

-- 

2. Please help me test my app

HI everyone,

I have recently made a Knots and Crosses game. I have only one Android
device and would like to get feedback on other devices. Also if anyone has
suggestions for the AI please tell me. You can download it at
https://www.raghavsood.com/downloads/android/apps/kac.

Thanks
-- 
Raghav Sood
http://www.raghavsood.com/

-- 

3. Create native typeface in 2.31

4. App not showing up Motorola Xoom's Market

5. Upgrade Radio

6. Menu Help

7. Gmail bermasalah setelah update ke ver.2.3.4.1