0
我不能編譯下面的代碼:類型不兼容 - 要求:android.net.Uri,發現:整數
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);
}
烏里mUpdatedObject給我一個錯誤Incompatible types - Required: android.net.Uri, found: int.
。我不明白爲什麼/在那裏看到,因爲getMyUri返回一個開放的一個int ...
public Uri getMyUri() {
return myUri;
}