Hi Mark, I could make the relationship with the changes you told me ,but I got this exception inside of Backendless.Data.of(BackendlessUser.class).addRelation…
FATAL EXCEPTION: main java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Void
Backendless.Data.of(ResultadoCuestionario.class).save(resul, new AsyncCallback<ResultadoCuestionario>()
{ @Override
public void handleResponse(final ResultadoCuestionario response1)
{
showToast(“SUCCESSFULL TABLA RIESGO:” +" " + response1.getObjectId());
ArrayList<ResultadoCuestionario> lista=new ArrayList<ResultadoCuestionario>();
lista.add(resul);
Backendless.Data.of(BackendlessUser.class).addRelation(currentUser, "risk",lista, new AsyncCallback<Void>()
{
@Override
public void handleResponse(Void response)
{
showToast("SUCCESSFULL USER-RIESGO");
}
@Override
public void handleFault(BackendlessFault fault)
{
showToast("UNSUCCESSFULL USER-RIESGO");
}
});
}
@Override
public void handleFault(BackendlessFault fault)
{
showToast("FAILED TO SAVE RESUL CUIESTIONARIPO:" +" " + fault.getCode());
}
Sorry for the mistake, I made a mistake reading the docs, but in the docs there is this example:
Person personObject = // personObject retrieval is out of scope in this example
Address addressObject = // addressObject retrieval is out of scope in this example
ArrayList<Address> addressCollection = new ArrayList<Address>();
addressCollection.add( addressObject );
Backendless.Data.of( Person.class ).addRelation( personObject, “address:Address:n”, addressCollection,
new AsyncCallback<Integer>()
{ @Override
public void handleResponse( Integer response )
{
Log.i( “MYAPP”, “related objects have been added”);
}
Hi Sergey,
I’ve realised that the 3rd parameter must be a String in order to fix the error, but according to documentation it may be a String clause or ArrayList<> ,but with the last one does not work , the popup only says cannot resolve method addRelation… anonymous com.backendless.async.AsyncCallBack<java.lang.Integer>
and I’m using gradle