拜托,每当我尝试构建我的 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();
}
}
}//
);
错误:
Error:(46, 45) error: is not abstract and does not override abstract method done(List,ParseException) in FindCallback
Error:(48, 16) error: name clash: done(List,ParseException) in and done(List,ParseException) in FindCallback have the same erasure, yet neither overrides the other where T is a type-variable: T extends ParseObject declared in interface FindCallback
这里是 Screenshot
最佳答案
您还没有参数化您的匿名 FindCallback
子类,所以你的 done
签名与 FindCallback#done
不匹配签名因为 done
未参数化版本中的签名是 done(List<Object>results, ParseException e)
.
要修复它,请参数化它:
userRelations.getQuery().findInBackground(new FindCallback<ParseObject>() {
// Add ---------------------------------------------------^^^^^^^^^^^^^
关于java - 错误 : anonymous class is not abstract and does not override abstract method,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34544646/