Android project does not delete record in Sqlite database

Asked

Viewed 12 times

1

My application makes insertions and reading the existing records in the Sqlite database, but when I will run a delete I have the following log message:

W/Fileutils: Failed to chmod(/Storage/sdcard/Cardapio Digital/Database/dbcardapio.sqlite): android.system.Errnoexception: chmod failed: EPERM (Operation not permitted)

my permissions in the manifest:

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>

my data access class:

public class PedidosDao {

    Context context;
    variaveis v;
    SQLiteDatabase db;


    public PedidosDao(Context context, variaveis v) {
        this.v = v;
        this.context = context;
    }

    public void deletaItem(int codigo){
        db = context.openOrCreateDatabase(v.getPathBanco(),Context.MODE_WORLD_WRITEABLE,null);

        try{

            db.execSQL("DELETE FROM PEDIDOS WHERE ID = "+codigo);

        }catch(Exception e){
            e.printStackTrace();
        }
        db.close();
    }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.