Fetch from phone book - crashes

by RAJENDIRAN SUNDARRAJAN-CPB738 » Tue, 18 Nov 2008 23:11:29 GMT


Sponsored Links
 Hi 
 
I was trying to fetch the contact number and name from the phone book.
But while querying for the content, it crashes. Below is the code that I
was using. 
 
ContentResolver cont = getContentResolver();

Cursor c = cont.query(Phones.CONTENT_URI, null, null, null, null);  //
crashes here

startManagingCursor(c); 

// Create an array to specify the fields we want to display in the list
(only TITLE)

String[] from = new String[]{Phones.NAME};

// and an array of the fields we want to bind those fields to (in this
case just text1)

int[] to = new int[]{R.id.text1};

ListAdapter adapter = new
SimpleCursorAdapter(this,R.layout.contacts_row,c,from,to );

setListAdapter(adapter);

 

Thanks

Sundar


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



Other Threads

1. Mapping Multiple textures to a cube in Android OpenGL ES

No, that's not what cube maps are for.

You can only draw 1 texture at a time (unless multitexturing but
that's totally different and not what you want) so you have 2 options:

1)  Combine all textures together into a single one and map the
coordinates to each side accordingly (will run much faster)
2)  Draw side-at-a-time binding to the appropriate texture for each
side. (not usually the preferred method.)

A trick many of us use when doing something like... say you want to
have the user pick 6 photos from their SD card and then you want to
display those on a cube, one on each face.  At some point you must
load each photo up, clipping and scaling it to fit aspect ratio and a
power-of-two texture and then uploading it to vram.  Well, instead of
uploading each one as a separate texture, why not just create a
1024x1024 bitmap and draw all 6 photos to it in different spots.  You
could use 50% of the texture vertically and 33% horizontally (for
example) to pack 6 photos onto it for 100% usage.  It's ok if they
distort going on to it so long as you draw them aspect-correct.  You
then keep track of which one is where (using UVs, so percentages from
0 to 1).  Upload that texture atlas as a single texture and when you
draw your cube, you just bind to that atlas once and draw everything
in one shot.  It'll run fast and it's not really that hard to do.




-- 

2. OOT paging Abangkis mw tanya seputar badminton

bro abangkis minta tolong japriin dong ym/msn ke
lozz_kel...@hotmail.com

-- 
"Indonesian Android Community [id-android]" 

3. Android SDK and Helios - compatibility problems?

4. why is there no android tablet nearly as good as ipad?

5. Track user location.

6. UltimateFave

7. Implementing a toolbar/taskbar kind of thing.