i have got ListView of Inbox SMS.I am trying, if i click on any item in the ListView,it will open Sms Manager with filled destination number from recieved sms,but i dont know how i can do it.Can somebody help me?Sorry for my english.
list1.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg, View view, int position,long id) {
SmsManager m = SmsManager.getDefault();
Uri uriSMSURIs = Uri.parse("content://sms/inbox");
int poss = list1.getSelectedItemP开发者_运维百科osition();
String pos = String.valueOf(poss);
Log.d(TAG, "pos: " + pos);
Cursor cc = getContentResolver().query(uriSMSURIs, null, pos, null, null);
String phoneNumber = cc.getString(cc.getColumnIndex("address"));
m.sendTextMessage(phoneNumber , null, null , null, null);
You can call the default SMS app with an Intent:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("address", "123456789");
sendIntent.putExtra("sms_body", "Content of the SMS goes here...");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
精彩评论