Reputation: 4260
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.
Upvotes: 1
Views: 2104
Reputation: 262
Query the ContactsContract.Data and use these aliases http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Organization.html
Upvotes: 3