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. expanding space for apps in sd card

Hi,

I'm studying app2sd solution to expand space for apps using sd card.
I think the use of a looped ext2 img file is more easy to handle by
scripts to be used in softwares like htc sync (or any sync) however i
think triggering an sd scan seeking for extra ext2 partition or an
ext2 img file on the sd card could be a nice way to a further option
in the android preferences: which is "select a different partition to
store your apps"

-- 

2. Select/Highlight/Focus on Text in a WebView

Hi,

I was wondering if there is a way to select or highlight or focus at
text from a webview's content.

Or even select and copy text to the clipboard? (just like the default
browser)

Or even access the emulateShiftHeld() function?

I'm working on an browser and am trying to add accelerators but I can
really only focus on links and buttons.

Thanks.

--

3. Android Market Problems...

4. Mobile & Embedded Industry Expert Opinions Needed

5. Looking for a developer to give a student talk on Android Development

6. Upload to My Maps user account

7. How to build EditText view like that in Android Market edit text (the top part)