Reputation: 93
I am using Android Studio and following cloud code guide of parse.com: https://parse.com/docs/cloud_code_guide
After deploying the first example which defines function "hello" on the cloud, I run below code in my Android project(I call the code in MainActivity:onCreate)
ParseCloud.callFunctionInBackground("hello", new HashMap<String, Object>(), new FunctionCallback<String>() {
void done(String result, ParseException e) {
if (e == null) {
// result is "Hello world!"
}
}
});
I get this error:
Error:(29, 116) error: is not abstract and does not override abstract method done(String,ParseException) in FunctionCallback
Upvotes: 0
Views: 917
Reputation: 31
You probably forgot to add @override. Mine is working with this code. Good luck!
Map<String, String> params = new HashMap<String, String>();
ParseCloud.callFunctionInBackground("hello", params, new FunctionCallback<Object>() {
@Override
public void done(Object object, ParseException e) {
Toast.makeText(mContext, object.toString(), Toast.LENGTH_LONG).show();
}
});
Upvotes: 1
Reputation: 1
I had the same error!
After a while I've found out that I was importing the wrong ParseException class.
Android Studio auto import the class java.text.ParseException, when the correct one is com.parse.ParseException.
Just change the import and see if it works.
Upvotes: 0
Reputation: 1836
Try to call the cloud function via the below code;
ParseCloud.callFunctionInBackground("hello", new HashMap<String, Object>(), new FunctionCallback<String>() {
public void done(String result, ParseException e) {
if (e == null) {
System.out.println("Result:"+result);
}
}
});
Also ensure that use proper Cloud function name and your Parse application is initialized. Hope this helps.
Regards.
Upvotes: 0