Android:Hello,i am creating Sms aplication.I have ListView of all sms and i am trying if i click on any sms in listview it's open SmsManager where will be number of that sms.But there is unexpected end of aplication if i click on any message in listview. Thank you for help.
There is source code:
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
SmsManager m = SmsManager.getDefault();
Uri uriSMSURIs = Uri.parse("content://sms/inbox");
Cursor cc = getContentResolver().query(uriSMSURIs, null, null, null, null);
String destinationAddress = cc.getString(cc.getColumnIndex("address"));
m.sendTextMessage(destinationAddress , null, destinationAddress , null, 开发者_运维问答null);
}
});
}
Try debugging your app.
You should at least provide logcat (error log) and the line in code that produces the error/exception.
You are not using the index of the item which is clicked. What you are doing instead is fetching all rows for column "address"
精彩评论