I have a problem, i’m trying to retieving information from my database i made it synchronous and Asynchronous form and the two ways i had the same result null.
this is my class:
public class Tabl2Categories {
private String objectId;
private String categoryName;
public String getObjectId()
{
return objectId;
}
public void setObjectId(String objectId)
{
this.objectId = objectId;
}
public String getCategoryName()
{
return categoryName;
}
public void setCategoryName(String categoryName)
{
this.categoryName = categoryName;
}
}
and this is how i call:
Backendless.Persistence.of(TableCategories.class).find(new AsyncCallback<BackendlessCollection<TablaCategories>>() {
@Override
public void handleResponse(BackendlessCollection<TablaCategories> tablaCategoriesBackendlessCollection) {
categories = tablaCategoriasBackendlessCollection;
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast msg = Toast.makeText(getApplicationContext(), backendlessFault.getMessage(), Toast.LENGTH_SHORT);
msg.show();
}
});
Please help me with this error.
What exactly is null here?
Well the object returned in the handleResponse Called tablaCategoriesBackendlessCollection is null does not give anything from the database
There are a few inconsistencies in the code. I am not sure if they are typos or that’s how you have it:
The class name is "Tabl2Categories"
You're doing data retrieval from "TableCategories"
The responder references "TablaCategories"
So three different names where in reality it should all be the same...
yes sorry the inconsistencies is because my tablename is in Spanish when i posted my issue i tried to change everything to english for that you can understand my code.
but my Class name, retrieval object and Resposer the Type is “TablaCategorias”, but i still without get the information from the Database
this is my get code
Backendless.Persistence.of(TablaCategorias.class).find(new AsyncCallback<BackendlessCollection<TablaCategorias>>() {
@Override
public void handleResponse(BackendlessCollection<TablaCategorias> tablaCategoriasBackendlessCollection) {
resultado = tablaCategoriasBackendlessCollection;
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast msg = Toast.makeText(getApplicationContext(), backendlessFault.getMessage(), Toast.LENGTH_SHORT);
msg.show();
}
});
And this is a screen from my DB
Hi Franklin,
If you set a breakpoint on the following line:
resultado = tablaCategoriasBackendlessCollection;
What does the debugger show for the “tablaCategoriasBackendlessCollection” object?
Regards,
Mark
i got this error
BackendlessException{ code: ‘Internal client exception’, message: ‘null’ } when i use
BackendlessCollection<TablaCategorias> resultado = Backendless.Persistence.of(TablaCategorias.class).find();
This occurs because you’re using synchronous API on the main UI thread. Android does not allow blocking IO (which is what happens in the sync calls). You either need to create a new thread and make the find() call there, or use the Async version of the API.
Franklin, I’ve noticed that you don’t have default no-arguments constructor in the class. Check if you have it in your original class version.