I don't think you can delete using the inbox Uri. Try deleting content://sms/7
or content://sms/raw/7 instead.


On Jan 26, 10:30 pm, ipeg.stud...@gmail.com wrote:
> Please help Me!!!
>
>       I am stuck with a small problem for several days, I am unable to
> delete any SMS.
>      The error is in just 1 line.
>
>      Look at the code below and the associated XML .
>
>      If I run the code, it shows the list of all SMS in my inbox.
> There is an SMS whose _ID is equal to 7 .
>
>  If I enable the line
> getContentResolver().delete(......
>
> which I have commented, my program crashes in the emulator.
>
> What is going wrong? Please help me out.
>
> #############################################################################
> #############################################################################
> #############################################################################
> package org.anddev.android.hello;
>
> import android.app.ListActivity;
> import android.content.Intent;
> import android.database.Cursor;
> import android.net.Uri;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.ListAdapter;
> import android.widget.ListView;
> import android.widget.SimpleCursorAdapter;
>
> public class HelloAndroid extends ListActivity {
>
>      private ListAdapter mAdapter;
>
>     @Override
>     public void onCreate(Bundle icicle) {
>         super.onCreate(icicle);
>
>           Uri uri = Uri.parse("content://sms/inbox/");
>           String[] columns = new String[]{"_ID"};
>           int[] names = new int[]{R.id.row_entry};
>           Cursor c1= getContentResolver().query(uri, null,
> null,null,null);
>
>          // getContentResolver().delete( uri  , " _ID = 7 ", null);
>
>           mAdapter = new SimpleCursorAdapter(this, R.layout.main, c1,
> columns, names);
>           this.setListAdapter(mAdapter);
>     }
>
> }
>
> #############################################################################
> #############################################################################
> #############################################################################
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>     package="org.anddev.android.hello">
>     <uses-permission android:name="android.permission.READ_SMS" />
>     <uses-permission android:name="android.permission.WRITE_SMS" />
>     <uses-permission android:name="android.permission.RECEIVE_SMS" />
>
>     <application android:icon="@drawable/icon">
>         <activity android:name=".HelloAndroid" android:label="@string/
> app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category
> android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>         </activity>
>             <activity android:name=".Hello" android:label="@string/
> app_name">
>
>         </activity>
>            <activity android:name=".Hello1" android:label="@string/
> app_name">
>
>         </activity>
>     </application>
> </manifest>
>
> #############################################################################
> #############################################################################
> #############################################################################

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to