Problem with the training course (Android)

I am trying to use Parse to program an android application. I follow the manual at this link: https://www.parse.com/docs/android_guide

While the manual / guide is pretty straight forward, I had a problem with querying the Parse database. Specific part of the manual: https://www.parse.com/docs/android_guide#objects-retrieving

Code in the appropriate section:

ParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore"); query.getInBackground("xWMyZ4YEGZ", new GetCallback<ParseObject>(){ public void done(ParseObject object, ParseException e){ if (e == null){ // object will be your game score } else { // something went wrong } } }); 

I am using Android Studio 1.0.1, and the error I am getting is:

The class' Anonymous class derived from GetCallback 'must be either a declared abstract or implementing the abstract method' done (T, ParseException) in GetCallback

Any help or suggestions on how to solve this problem would be greatly appreciated, thanks.

EDIT:

It turns out that it was only my database on Parse.com, which was somehow corrupted ... The creation of a new database was fixed for some reason. However, I have another problem. I can debug inside the made function, and the object contains all the information. However, I cannot extract it beyond the scope of the function made. How it's done? Thanks.

+5
source share
2 answers

I got the same error. In my case, I automatically imported the wrong library:

 import java.text.ParseException; 

instead

 import com.parse.ParseException; 

Just check your import.

+3
source

I do not think that's possible. the function executed is the callback method when the request is complete. If you are debugging your code, you will notice that it is executing a function because it is called asynchronously, which means that the application will not wait for it to complete.

As soon as the request returns, you should check if there was an error, and then do everything you need after you have extracted the parsing object.

0
source

Source: https://habr.com/ru/post/1211336/


All Articles