请问,每当我尝试构建我的android项目时,我在下面的方法中都会出错。
方法:
query.findInBackground(new FindCallback() {
@Override
public void done(List<ParseObject> objects, ParseException e) {
mProgressBar.setVisibility(View.INVISIBLE);
if (e == null) {
objects = removeCurrentUser(objects);
mUsers = objects.toArray(new ParseObject[0]);
// Get user relations
ParseRelation userRelations = ParseUser.getCurrentUser().getRelation("UserRelation");
userRelations.getQuery().findInBackground(new FindCallback() {
@Override
public void done(List<ParseObject> results, ParseException e) {
if (e == null) {
UsersAdapter adapter = new UsersAdapter(SelectUsersActivity.this, mUsers, new ArrayList<ParseObject>(results));
setListAdapter(adapter);
}
else {
Log.e(TAG, "Exception caught!", e);
}
}
});
}
else {
// Something went wrong.
Toast.makeText(SelectUsersActivity.this, "Sorry, there was an error getting users!", Toast.LENGTH_LONG).show();
}
}
}//
);
错误:
错误:(46,45)错误:不是抽象而不是 覆盖FindCallback中的抽象方法done(List,ParseException)
错误:(48,16)错误:名称冲突: 在和中完成(List,ParseException) FindCallback中的done(List,ParseException)具有相同的擦除, 但是,当T是一个类型变量时,它们都不会覆盖另一个:T扩展 在接口FindCallback
中声明的ParseObject
答案 0 :(得分:2)
您尚未对您的匿名FindCallback
子类进行参数化,因此您的done
签名与FindCallback#done
签名不匹配,因为done
签名非参数化版本为done(List<Object>results, ParseException e)
。
要修复它,请对其进行参数化:
userRelations.getQuery().findInBackground(new FindCallback<ParseObject>() {
// Add ---------------------------------------------------^^^^^^^^^^^^^