Error: HashMap cannot be cast to class of android studio

Okkz i will try too i think same mistake here

Below is the error when i moved the backendless.initApp() to just above the code where i am using the backendless code. I think i am making an error in initializing it. I used

Backendless.initApp(this,APP_ID, ANDROID_SECRET_KEY, “v1”);This is the error:

03-11 20:49:21.867 2944-2960/? E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-165
Process: com.example.akhil.quizit, PID: 2944
java.lang.ClassCastException: com.example.akhil.quizit.GKPaper$2 cannot be cast to android.content.Context
at com.backendless.ContextHandler.setContext(ContextHandler.java:31)
at com.backendless.Backendless.initApp(Backendless.java:127)
at com.example.akhil.quizit.GKPaper$2.run(GKPaper.java:96)
at java.lang.Thread.run(Thread.java:818)

The first argument for the initApp call must be an instance of android.content.Context. You can use the activity object there.

which activity object??

Your Android activity

i have many activity in m project. Are u saying that i should use the activiy name in which i am coding the backendless?
Backendless.initApp(GKPaper.class,App_id, secret key, “v1”);GKPaper is the class name where i am coding this

Use your main activity object. Not class, but object. Here’s an example:

In this link “this” is used in the Backendless.initApp and not the object that u r specifying

How to specify the object?

In that link “this” is referring to the activity where the code is executed.

ya i also used the same…
but facing that error
“cannot be cast to android.content.Context”

Perhaps this will help: http://stackoverflow.com/questions/2002288/static-way-to-get-context-on-android

whats this…??
why should i refer to the context as i am using “this”

Because “this” you’re using is obviously not an instance of android.content.Context.

I have done the above change but still the error remains the same…

Backendless.initApp(MyApplication.getAppContext(),APP_id, Secret_key, “v1”);

ClassCastException? Could you show complete stack trace please?

http://support.backendless.com/public/attachments/b0cbbd60d58048cb43e5f0d68dda1d88.jpg</img>This is the error…

Make sure to use the following API for all related entities:

Backendless.Data.mapTableToClass( “name-of-the-table-where-you-keep-GK-objects”. GK.class )

Regards,
Mark

I used it in only 1 place…