开发者

how i can get the each sms id in android

actually i want to delete sms from inbox as per id i am using following cod开发者_如何学Pythone

but it showing error

my code:

Uri deleteUri = Uri.parse("content://sms/");
Cursor m_cCursor=context.getContentResolver().query(deleteUri, null, null,    null, null);
int m_cnum=m_cCursor.getCount();
int id =m_cCursor.getInt(0);
int thread_id = m_cCursor.getInt(1);

the error is:

 0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 21]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: android.content.ContextWrapper
        [pc: 0, pc: 10] local: name index: 1 type: java.lang.String
        [pc: 0, pc: 10] local: mode index: 2 type: int


Did you do m_cCursor.moveToFirst() and m_cCursor.moveToNext()?


After

 Cursor m_cCursor=context.getContentResolver().query(deleteUri, null, null,    null, null);

add

     while (cur.moveToNext()) {
         int m_cnum=m_cCursor.getCount();
         int id =m_cCursor.getInt(0);
         int thread_id = m_cCursor.getInt(1);
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜