Whi i can’t delete a row (line) in my Backendless class?
String i = worldpopulationlist.get(position).getUrlPhoto(); // get the item’s url Photo
String t = worldpopulationlist.get(position).getTitle(); // items title//
String d = worldpopulationlist.get(position).getDatePhoto(); // items date
final guestPhotoTable contact = new guestPhotoTable();
Backendless.Persistence.save( contact, new AsyncCallback<guestPhotoTable>()
{
public void handleResponse( guestPhotoTable savedContact )
{
Backendless.Persistence.of( guestPhotoTable.class ).remove( savedContact, new AsyncCallback<Long>()
{
public void handleResponse( Long response )
{
Toast.makeText(v.getContext(), text4, Toast.LENGTH_LONG).show(); // THIS Toast is showing when the button is clicked !!!
}
public void handleFault(BackendlessFault fault )
{
// an error has occurred, the error code can be retrieved with fault.getCode()
}
} );
} @Override
public void handleFault( BackendlessFault fault )
{
The scope of our support here is on Backendless API and backend services. We do not provide support for questions and tasks related to user interfaces. Please consider posting your question to an Android forum or Stackoverflow.com.
Toast message that inside handleResponse( Long response ) method is showing, so i can suppose that command is correctly.
I can suppose that correctly command doesn’t delete row but i can’t understand HOW can i delete it?
My question about deleting row and not about Android.
Is there any mistake in Backendless API code in my question?
I called same (!) code like in documentation - there is no result.
public void deleteContact(){ // put the initApp call somewhere early on in your app, perhaps main activity String applicationID = ""; String secretKey = ""; String version = ""; Backendless.initApp( appContextOrActivity, applicationID, secretKey, version); Contact contact = new Contact(); contact.setName( "Jack Daniels" ); contact.setAge( 147 ); contact.setPhone( "777-777-777" ); contact.setTitle( "Favorites" ); Backendless.Persistence.save( contact, new AsyncCallback<Contact>() { public void handleResponse( Contact savedContact ) { Backendless.Persistence.of( Contact.class ).remove( savedContact, new AsyncCallback<Contact>() { public void handleResponse( Long response ) { // Contact has been deleted. The response is a time in milliseconds when the object was deleted } public void handleFault( BackendlessFault fault ) { // an error has occurred, the error code can be retrieved with fault.getCode() } } ); } @Override public void handleFault( BackendlessFault fault ) { // an error has occurred, the error code can be retrieved with fault.getCode() } }); }
I tried twice. Still no result. Log takes me correct data (correct Url, correct DatePhoto, correct Title).
The sample code in the docs creates a new object and then deletes (this is done because there must be a REAL. VALID object in order for it to be deleted). If you run the code from the sample without any changes, of course there will be no result Because we create contact and immediately delete it. What were you expecting?