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[] {

                int [] tempInt= new int[]{};

                Cursor managedCursor =
projection, null, android.provider.Contacts.PeopleColumns.NAME + "

                ListView contactsList = (ListView)findViewById(;

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


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

Does anybody see my fault?


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?



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 didn't see


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


setListAdapter(new LevelAdapter(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) 
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!


Other Threads

1. Encoding problems in localizations/EULA question

I encode my files in UTF-8. It is probably the right choice if you have any
characters that cannot be encoded in a 'normal' text file.CP1252 is a form
of Latin-1, which lacks quite a few characters if you need eastern-European
(and many other languages).(I remember when I changed mine to UTF-8, it took
a bit for Eclipse to actually accept this as the encoding is inherited down
from preferences somehow).

(What will you do if someone violates you EULA? Will you take someone to
court in Poland? How would you know anyway?...I would not assume that
having/not having an EULA will make a vast difference, whether it is in
Czech or English)


2009/1/18 Sundog <>


2. Trying to compile Android on to a Full blown ubuntu/linux distro

Peace All!

Hi, has anybody tried to compile Android on top of a full blown linux
distribution like ubuntu?

My rationale is that if we do get this thing to work and then attach a
GSM modem (usb or serial port type) with excellent AT command
documentation, we can really do some serious movement in terms of
turning a netbook or a good smartphone into a single port VOIP gateway
or have applications work over the actual voice channel (not the
digital voice channel) and record conversations.

For netbooks (if we can figure out how to lower the power consumption
problem so that a netbook can last as long as an acceptable smartphone/
mobile phone) with the GSM modem, there's a ton of possibilities and
products that can come out of it. (e.g. you can have bluetooth to
answer  your calls and take down messages for you from a good PC
powered voice recognition software)

I know I must sound crazy but I do think I have something here.


3. SFTP applicatio

4. Moving project between machines

5. RotateAnimation, pivoting about the center

6. totally confused about how to change the layout of a button at runtime

7. How do I get the View dimension after the View has been laid out?