dimanche 5 avril 2015

Incompatible types - Required: android.net.Uri, found: int.


Vote count:

0




I can't compile the following code:



public long create (Context mContext, ContentValues rights ){
Long id;
Uri mNewOwner = mContext.getContentResolver().insert(
this.getMyUri(),
rights);
id=ContentUris.parseId(mNewOwner);
this.setID(id);
this.setMyUri(ContentUris.withAppendedId(CONTENT_URI, id));
return id;
}

public void update(Context mContext){
ContentValues updatedValues = new ContentValues();
updatedValues.put(Game2user.FIELD_RIGHTS_POWER, this.getRightPower());
updatedValues.put(Game2user.FIELD_RIGHTS_EVENT, this.getRightEvent());
updatedValues.put(Game2user.FIELD_RIGHTS_RULE, this.getRightRule());
updatedValues.put(Game2user.FIELD_RIGHTS_USER, this.getRightUser());
updatedValues.put(Game2user.FIELD_RIGHTS_GAME, this.getRightGame());
updatedValues.put(Game2user.FIELD_IS_PLAYER, this.getIsPlayer());
Uri mUpdatedObject = mContext.getContentResolver().update(
this.getMyUri(),
updatedValues,null,null);
}


Uri mUpdatedObject gives me an error "Incompatible types - Required: android.net.Uri, found: int." . I don't understand why/where it sees an int since getMyUri returns an Uri...



public Uri getMyUri() {
return myUri;
}


asked 1 min ago







Incompatible types - Required: android.net.Uri, found: int.

Aucun commentaire:

Enregistrer un commentaire