开发者

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

开发者 https://www.devze.com 2023-03-03 06:43 出处:网络
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);

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

精彩评论

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