ListView display problem

by andyn » Thu, 10 Jul 2008 20:44:34 GMT


Sponsored Links
 Hi there,

I want to include a listview displaying my contacts' names.
I have the following code:

------------------
String[] projection = new String[] {
                                android.provider.BaseColumns._ID,
                                android.provider.Contacts.PeopleColumns.NAME,
                                android.provider.Contacts.PhonesColumns.NUMBER
                                };

                int [] tempInt= new int[]{R.id.nameList};

                Cursor managedCursor =
this.managedQuery(android.provider.Contacts.Phones.CONTENT_URI,
projection, null, android.provider.Contacts.PeopleColumns.NAME + "
ASC");

                ListView contactsList = (ListView)findViewById(R.id.nameList);

                SimpleCursorAdapter contactsAdapter= new
SimpleCursorAdapter(this ,android.R.layout.simple_list_item_1,
managedCursor, projection, tempInt );
                contactsList.setAdapter(contactsAdapter);

-----------------

When running the application I also get a list with the correct number
of rows. But there's no content included. So the rows are just
empty...

Does anybody see my fault?

Thanks
--~--~---------~--~----~------------~-------~--~----~



ListView display problem

by daspears » Thu, 10 Jul 2008 23:16:56 GMT


 Have you setup the security permissions needed to read contacts info
in AndroidManifest.xml?

-Dave



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


Sponsored Links


ListView display problem

by andyn » Fri, 11 Jul 2008 23:07:23 GMT


 Yes, I set the security permissions. But I also found the error. I
forgot the "android:" in front of the "id" attribute in the xml file.
And that wasn't displayed in Eclipse as an error...so didn't see
it....





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



ListView display problem

by MrChaz » Sat, 02 May 2009 06:21:49 GMT


 I have a list activity which is doing something very strange when you
select items.
It doesn't seem to be de-selecting old items if you click on a
different one.
if you use the trackball it seems to select every other item and then
swap the selection as you move up and down.

I'm not doing anything special

just

getListView().setChoiceMode(ListView.CHOICE_MODE_NONE);
setListAdapter(new LevelAdapter(this));
getListView.setOnItemClickListener(this);


the LevelAdapter inflates a view from XML but I don't see why that
would be causing issues.
--~--~---------~--~----~------------~-------~--~----~



ListView display problem

by Mark Murphy » Sat, 02 May 2009 06:42:46 GMT


 > I have a list activity which is doing something very strange when you

Temporarily modify LevelAdapter to not inflate views itself, but let
Android handle it (even if this means you only show one bit of text or
something, rather than what you want your rows to look like). If your
problem goes away, the issue is somewhere in the way you are defining and
inflating the views.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!



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



Other Threads

1. Phoen application integration

Hi,

I am currently designing a VoIP application for the Android platform.
One requirement is the integration with the Phone application but
unfortunately the only hook available seems to be the
ACTION_NEW_OUTGOING_CALL intent.  What would be a good way to have a
better integration?  I am open to any suggestion, from rewriting the
Phone application from scratch to contributing modifications to the
Android platform, as long as it permit to distribute my application
through the Android Market.

Thanks.

-- 

2. NDK for SDK 2.0.1?

Hi there,

I'm creating a multimedia project for android, it's a performance
critic app so that I made a big effort on creating many things in
native code. The new SDK came out some time ago but here is no NDK
for, do anyone know if it will come out soon? Because if there are
already phones with the new SDK but no NDK for it I'm losing potential
users!

Kind regards
Moss

-- 

3. GLSurfaceView.Renderer render rate

4. Market Support Questions From Users/Buyers

5. How can I alway instantiate my ContentProvider

6. new sdk requires versionCode bump to install?

7. Dialog & windowBackground style item