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. Does Android support the linux 2.6.13 kernel?

Thanks in advance.

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

2. ANdroid coding guidelines

Where Can I find the Android PDF to start my coding.I do not know JAVA
but I know C and C++ and linux internals.

Is it a must to learn JAVA and start coding.
I do not know XML as well..


Please give me a hint on how to start working on Android and recommend
some material or PDF to start working.

Thanks in Advance

Syed Sameer Ahmed
(Google FAN)

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

3. Xmpp demo!

4. Is it possible to tell OS that Activity behind a translucent activity no longer needs to be drawn?

5. check the manifest for intent-filters

6. ActivityGroup unable to restart Activity

7. Is there any RPC library available with Android