java.lang.ClassCastException: java.util.HashMap cannot be cast to com.foodonomic.foodonomic.Category
I was working with Backendless.com APIs in one of my app. There when I Tried to call data from server
using this method
//Category is my class whose object I was trying to fetch from the Backendless //Server
Backendless.Data.mapTableToClass( "CategoryCode", CategoryCode.class );
Backendless.Persistence.of(CategoryCode.class).find(new AsyncCallback<BackendlessCollection<CategoryCode>>() {
@Override
public void handleResponse(BackendlessCollection<CategoryCode> foundContacts) {
Log.d("vivz","Inside handle response");
List<CategoryCode> code=foundContacts.getData();
Log.d("vivz",code.get(1).toString());
}
@Override
public void handleFault(BackendlessFault fault) {
//Snackbar.make(coordinatorLayout,"Network error, check your internet connection",Snackbar.LENGTH_LONG).show();
Log.d("vivz", "Error");
}
});
I got a Runtime Exception java.lang.ClassCastException: java.util.HashMap cannot be cast to com.foodonomic.foodonomic.Category
I have asked the same question there on Backendless Support, keeping in mind to get answers from more users of Backendless I am posting this here. Here is the link to the post that I had posted there on Backendless