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. SQLite transactions when using ContentResolver

The goal: refresh database from XML data

The process:

    * Start transaction
    * Delete all existing rows from the tables
    * Per each main element of parsed XML insert row into main table
and get PK
    * Per each child of the main element insert record into 2nd table
providing FK from the previous step
    * Commit transaction

Pretty standard stuff as far as db operations. The problem is that
CRUD operations are not done within ContentProvider but rather using
ContentResolver so the insert for example looks like
resolver.insert(CONTENT_URI, contentValues). The ContentResolver API
doesn't seem to have anything pertained to transaction and I cannot
use bulkInsert since I'm inserting in 2 tables intermittently (plus I
want to have delete inside the transaction as well).

I was thinking of registering my customized ContentProvider as
listener by using registerContentObserver but since
ContentResolver#acquireProvider methods are hidden how do I obtain the
right reference?

Am I out of luck?

-- 

2. How can I align an ImageView to the right of the Parent?

Hi,

I have the following l relative layout, which I want an Image to the
left and an Image to the right, then the rest is filled by TextView.
But I can't get the last image to align right of the parent. I have
added 'android:layout_alignParentRight="true"' but it does not work.


Any idea please?
Thank you.



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
        android:padding="6dip">

        <ImageView android:id="@+id/icon"
            android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_alignParentTop="true" />

        <TextView android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignWithParentIfMissing="true"
            android:layout_toRightOf="@id/icon"
            android:layout_alignParentTop="true" />
                
        <ImageView
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/text"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/icon" />

</RelativeLayout>

-- 

3. interpolatedTime in applyTransformation method

4. CheckoutCheck Open-Sourced

5. Easiest way to programmatically check if the Market app is installed?

6. Feature support in WebKit on Android?

7. importing android system parcelables in eclipse