Get company name in android using new API's

Posted by HellBoy on Stack Overflow See other posts from Stack Overflow or by HellBoy
Published on 2010-12-29T09:49:51Z Indexed on 2010/12/29 9:54 UTC
Read the original article Hit count: 169

Filed under:

Currently I am getting company name using following code

public class ContactsDemo extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Cursor cursor = getContentResolver().query(Contacts.Organizations.CONTENT_URI, 
            null, null, null, null);
    //ContactsContract.CommonDataKinds.
    if(cursor!=null){
        System.out.println(cursor.getString(cursor.getColumnIndex
                (Contacts.Organizations.COMPANY)));
    }}}

but I don't want to use deprected API's. & in new API's there is no CONTENT_URI in Organisation class. How to get company name using new API.

© Stack Overflow or respective owner

Related posts about android