Null response while saving in the database

Below is the code I am using to save in the database

// save object asynchronously
        HashMap user = new HashMap();
        user.put( "username", newUser.getUsername());
        user.put( "userid", newUser.getUserID());
        user.put( "avatar", newUser.getAvatarURL());
        user.put( "deviceID", newUser.getDeviceID());
        user.put( "userType", newUser.getUserType());
        user.put( "email", newUser.getEmailAddress());
        user.put( "followerCount", newUser.getFollowersCount());
        user.put( "followingCount", newUser.getFollowingCount());
        user.put( "likeCount", newUser.getLikesCount());

       // Toast.makeText(LoginActivity.this,"User Values "+user,Toast.LENGTH_LONG).show();


        // save object asynchronously
        Backendless.Data.of( "app_users" ).save( user,  new AsyncCallback<Map>() {
            public void handleResponse( Map response )
            {
                // new Contact instance has been saved
                Toast.makeText(LoginActivity.this,"User Created "+response,Toast.LENGTH_LONG).show();
            }

            public void handleFault( BackendlessFault fault )
            {
                Log.d("Error:",""+fault.toString());
                Toast.makeText(LoginActivity.this,"User Failed to be Created ",Toast.LENGTH_LONG).show();
                // an error has occurred, the error code can be retrieved with fault.getCode()
            }
        });

It runs the handleResponse function after the request is complete but returns a null response and also does not store anything in the database

pls help

Hello @Akshay_Lamba

Please provide your appId

Regards, Vlad

@vladimir-upirov 28A68326-1A1B-72C8-FFEC-DA64FDA4B400

it’s strange,

  • do you call Backendless.initApp before that code?
  • please provide what the SDK’s version you use

I am calling Backendless.initApp in my main activity as the app starts…SDK group: ‘com.backendless’, name: ‘backendless’, version: ‘5.0.+’

Do i need to call Backendless.initApp in every activity?

I just ran your code and don’t see any problems, the new object was created,
so try to debug your code

can you help with the same…I mean if you are running the same code what should I debug ?

try to put a debug breakpoint at this line
Backendless.Data.of( “app_users” ).save( user, new AsyncCallback() {

i did this…but Can not figure out the problem…

Please keep trying… we really cannot just start writing code for you.

really strange…I even can not read data … I entered a record manually using web console…and using the below code , I am trying to read data.

String whereClause = "userid = "+userID;
                DataQueryBuilder queryBuilder = DataQueryBuilder.create();
                queryBuilder.setWhereClause( whereClause );

                Backendless.Data.of( "app_users" ).find( queryBuilder,
                        new AsyncCallback<List<Map>>(){
                            @Override
                            public void handleResponse( List<Map> foundUser )
                            {
                                Log.d("USer ",""+foundUser);
                                // every loaded object from the "Contact" table is now an individual java.util.Map
                            }
                            @Override
                            public void handleFault( BackendlessFault fault )
                            {
                                Log.d("USer ","Error in Finding user");
                                // an error has occurred, the error code can be retrieved with fault.getCode()
                            }
                        });

Reading and writing both are a issue… @vladimir-upirov @mark-piller

Please attach a simple sample project that reproduces this issue.

Regards,
Olha

Sorry but I have shifted to parse… because of no support from backend less

Best of luck to you with parse