Backendless Support
 
Answered

Custom table does retrieve data from app

Hi there, I have a slight weird problem. It seems that my data does not want to save within my table. (See code snippet). I changed the Persistence into Data, changed gradle from 'com.backendless:backendless:4.0.3' to 'com.backendless:backendless:4.0.1' and I even used my message method I created (Shows dialog box with a message) to show the data using my getter method of the particular class to retrieve the object's data and display it on the screen, I have the data. It does not save on backendless. Any Ideas to solve this problem?

Leave a Comment

Comments (13)

photo
1

Hello,

Could you please post the source code of the class here?

Regards,

Mark

photo
1

Hi Mark,

Here is my class: See attached txt file

photo
1

I would like to see the Learner_Class class.

photo
1

Here is my class: See attached txt file

photo
photo
1

Which callback is invoked when you save the object? handleResponse or handleFault?

photo
1

Handle Response callback is being invoked.

photo
1

That means the object was saved. Do you not see the Learner_Class table in Backendless console?

photo
1

I do see the table, but the record shows null values. If I download the data afterwards it shows null on my custom List I have created within my app.

photo
1

Could you try changing your class so the private fields (and getter/setter methods) do not have underscore?

photo
1

  1. final Learner_Class learner = new Learner_Class(etName.getText().toString(),etSurname.getText().toString(),etId.getText().toString(),cbClassName.getSelectedItem().toString(),
  2. etRace.getText().toString(), etGender.getText().toString(),etDOB.getText().toString(),etInsLang.getText().toString(),etLearnerType.getText().toString()
  3. , etP_ID.getText().toString(),etTuckShopBalance.getText().toString());
  4. Backendless.Persistence.of(Learner_Class.class).save(learner, new AsyncCallback<Learner_Class>()
  5. {
  6. @Override
  7. public void handleResponse(Learner_Class response)
  8. {
  9. ...
  10. }
  11. @Override
  12. public void handleFault(BackendlessFault fault)
  13. {
  14. ...
  15. }
  16. });

This should work. But it does not show anything (see the code snippet) I added statically the data on backendless to debug my app. Using my application to add a learner to backendless it gives me blank spaces as you can see.

photo
1

Did you declare the columns in the table by hand or were they created by Backendless?

I recommend removing underscores in the class (and in the table columns) and follow the following naming convention:

public class Foo

{

private String name;

public void setName( String name ) { this.name = name; }

public String getName() { return name; }

}

photo
1

Hi thank you for the advise. Will change it now.

photo
1

Hi Mark,

Thank you for the help. The naming conventions made a huge difference. It works.