Getting IM Ids from the contact database in 2.0

by Raj » Fri, 20 Nov 2009 04:36:01 GMT


Sponsored Links
 Finally I did this way and it works...

 String[] cols =
{ ContactsContract.Data.DATA1,ContactsContract.Data.DATA5};
           Cursor ims = getContentResolver().query(
                           ContactsContract.Data.CONTENT_URI,
                           cols,
                           ContactsContract.Data.CONTACT_ID +" = "+  id + " and 
"
                           + ContactsContract.CommonDataKinds.Im.MIMETYPE + " =
'vnd.android.cursor.item/im'",
                           null, null);

           while (ims.moveToNext()) {
                           String im = ims.getString(
                           ims.getColumnIndex(
                           ContactsContract.Data.DATA1));

                           Log.d(TAG,"Im : " + im);
           }
           ims.close();
where id is the contact id

Raj





--



Other Threads

1. File Access Error.

Hi all,

I have made a simple game application that saves to a file named
"scores.txt" (no prizes for guessing what it saves there..). The
activity containing the actual game does the saving, and I am trying
to access the file and display its contents from the main menu
activity.

However when I attempt to open the file I get the error:
11-28 17:13:59.617: ERROR/I/O ERROR(193): Error when trying to access
scores.txt - java.lang.IllegalStateException: The specified child
already has a parent. You must call removeView() on the child's parent
first.

I'm not sure what this means, as I get this error whether I have gone
straight to open the scores.txt file, or I have played the game first,
then tried to open the file.

If it is relevant, I have used mode 0, or MODE_PRIVATE on the
fileoutputstream in the "game" activity, however I don't think this
should make much difference as I am told by the documentation that:

"File creation mode: the default mode, where the created file can only
be accessed by the calling application (or all applications sharing
the same user ID)."

Though I am in a different activity, the application remains the
same...

Any help would be much appreciated! :)
--~--~---------~--~----~------------~-------~--~----~

2. Gallery setScrollIndicators

Hi,

 I want to have right and left scrolll indicators which will scroll
the gallery. I searched and found that earlier version of SDK had
Gallery.setScrollIndicators(View, View) but its not there anymore.
What is the suggested alternative? I will appreciate any advice/
pointers?

Regards,
Amit.

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

3. Open a HTML file

4. Can i write android code without activity (just with service)

5. Minimum PC Requirement for Using Android SDK

6. Keeping network connection alive when paused - Service?

7. Porting android to omap 2430