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. Cannot create new Android Projects

My Eclipse framework no longer create new Android Projects.  I get the
following error:

Cannot create linked resource '/.org.eclipse.jdt.core.external/
folders/.link0'.  The parent resource is not accessible.

After clicking past the error, I see a stub project with three errors:

one.test.Main does not extend android.app.Activity      AndroidManifest.xml
1Test   line 8  Android Problem
The project was not built since its build path is incomplete. Cannot
find the class file for java.lang.Object. Fix the build path then try
building this project   1Test           Unknown Java Problem
The type java.lang.Object cannot be resolved. It is indirectly
referenced from required .class files   R.java  1Test/src/one/test      line 1
Java Problem


Looking at the project properties, I see there is no Android Library
in the build paths.  I also don't know how to fix this manually.
(When adding a library, none of the options lists Android Library as
an option.  Nor does copying the library from other working project
seem to work.)

And just to be clear, I check the plugin preferences and made sure the
path to the Android SDK is correct.


Help!


--~--~---------~--~----~------------~-------~--~----~

2. ListView + scrolling + CHOICE_MODE_MULTIPLE = trouble?

As the subject implies, I've got a ListView that has more entries than
fit on the screen at one time, so it automatically scrolls, but also
each entry in the list can be checked or not (CHOICE_MODE_MULTIPLE),
and therein lies the problem.

Using the default settings (e.g. fadingEdge), I don't think it's
obvious at all that there are more entries in the list.  The scrollbar
on the side ignores my setting of scrollbarSize, so there is a tiny
little vertical bar on the edge, and a strange greyness at the bottom
of the list (the fadingEdge), neither of which jump out at me as
saying "Hey, user!  Scroll this list!"  Is this really the way the
Android folks intended scrolling lists to look?  Am I missing
something obvious?  Have people found a way to solve this UI
challenge?

Thanks!
Chris

--~--~---------~--~----~------------~-------~--~----~

3. LocationProvider power requirement

4. Authenticate a gmail account

5. GPS from GPhone

6. market search

7. AppMarket: does changing title/description of an app wipe out ratings and reviews?