tags:

views:

141

answers:

1

actually i want to delete sms from inbox as per id i am using following code

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 [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

A: 

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

Ilya A Landa