i created a contact in my avd and run the following application
package com.example.contents;
import java.util.Queue;
import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.widget.TextView;
public class ContentProviders extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri contacts= Data.CONTENT_URI;
TextView phone=null;
Cursor cur = managedQuery(contacts, null, null, null, null);
if(cur.moveToFirst()) //if cur!=null
{
do {
phone=new TextView(this);
phone.setText(cur.getString(cur.getColumnIndex
(Phone.NUMBER)));
setContentView(phone);
}while(cur.moveToNext());
}
}
}
But instead of the phone the name of the contact is returned.I also
tried to get the email from my contact but it didn't show
anything.What i am doing wrong?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en