安卓:你好,我正在创建短信应用程序。我有所有短信的listview,我正在尝试如果我点击列表视图中的任何短信,它是打开的SmsManager,其中将是该sms.But的编号。如果我点击列表视图中的任何消息,应用程序将意外结束。谢谢你的帮助。
这里有源码:
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);
}
});
}发布于 2011-02-15 20:16:57
试试debugging your app。
您至少应该提供logcat (错误日志)和代码中产生错误/异常的代码行。
发布于 2011-02-15 20:35:19
您没有使用所单击项目的索引。取而代之的是获取列"address“的所有行
https://stackoverflow.com/questions/5003196
复制相似问题