0

The insertDemmy() methods gives me

Unknown URL content://com.example.android.mypetdata/petsData

the petEntry class has the following Constants.

public static final String CONTENT_AUTHORITY = "com.example.android.mypetdata";
public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
public static final String PATH_PETS = "petsData";

public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, PATH_PETS);

 private void insertDummy(){
        ContentValues values = new ContentValues();
        values.put(petEntry.COLUMN_NAME, "Toto");
        values.put(petEntry.COLUMN_BREED, "Terrier");
        values.put(petEntry.COLUMN_GENDER, petEntry.GENDER_MALE);
        values.put(petEntry.COLUMN_WEIGHT, 7);
        try {
            Uri newUri = getContentResolver().insert(petEntry.CONTENT_URI, values);
        }catch (IllegalArgumentException e){
            Log.d(TAG,e.getMessage());
        }
}

I want the row should be inserted into the database instead of giving me Exception. I am not developing any application in fact this is for learning purposes. so please give me more description and clear description so that I understand it easily.

Talib Daryabi
  • 733
  • 1
  • 6
  • 28

0 Answers0