开发者

Access content://sms/sent in android 2.2(froyo)

i tried to take a data from outbox sms. Here is my code.

Cursor cursor = getContentResolver().query( Uri.parse("content://sms/sent"), null, null, null, null);

    String dateColumn = cursor.getColumnIndex("date");
    String bodyColumn = cursor.g开发者_如何学运维etColumnIndex("body");
    String addressColumn = cursor.getColumnIndex("address");

    output += new StringBuilder("\nMessage to: ").append(addressColumn)
            .append("\n\n").append(bodyColumn);
    Toast.makeText(context, output, Toast.LENGTH_LONG).show();

But when i start the program will be error, and ask to "force close".

Can anyone help me?


You need add this command before get the cursor values:

cursor.moveToNext();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜