Hi all,
I am developing an application with 2.0 sdk. I am trying to access the
contacts to get a number and send a SMS.
*Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.ContactsContract.CommonDataKinds. Phone.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);*
Below you can find the code to catch the selected number
*if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor c = managedQuery(contactData, null, null, null,
null);
if (c.moveToFirst()) {
String number =
c.getString(c.getColumnIndex(Phones.NUMBER));
SmsManager sm = SmsManager.getDefault();
sm.sendTextMessage(number, null, code, null, null);
setResult(RESULT_OK);
// finishes dialog activity
finish();
}
}*
The problem is that the highlighted line is not working. It triggers an
exception. Is there anything wrong in my way of using the contacts??
Any suggestion of how make it work?
Thks
Bye
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en