I have read the already posted solutions, but they dont tell how do I use system\'s contact details screen to select any ONE number to use? I am developing an sms sending an
this code just work fine with me
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent i = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
super.startActivityForResult(i, 1001);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 1001:
if (resultCode == Activity.RESULT_OK) {
Cursor s = getContentResolver().query(Phone.CONTENT_URI, null,
null, null, null);
if (s.moveToFirst()) {
String phoneNum = s.getString(s.getColumnIndex(Phone.NUMBER));
Toast.makeText(getBaseContext(), phoneNum, Toast.LENGTH_LONG).show();
}
}
break;
}
}