problem in sending multiple onjects

create ( java.util.List<java.util.Map> com.backendlessAsync.callback<java.util.List<java.lang.String>>) in IDataStore cannot be applied
to (java.util.List<java.util.Map<java.lang.String.java.lang.objects>>, anonymous com.backendless.asyn.callback.Async.callback<java.lang.Void>)

this is my problem showing
actually i want to store multiple data using single press of button. Please show how to write the code for this

Hello,

What version of the Backendless SDK do you use?

Regards,
Mark

I am using 5.0.0 version

Can you show the complete line of code where you make the “create” API call?

persons.create(person1);

private void updateValue(Map response,IDataStore<Map>persons) {
updateButton.setEnabled(false);
// List<Map<String, Object>> person1 = new ArrayList<>();
for (int j = 0; j < 1000; j++) {
Map<String,Object> person1 = new HashMap<>();
person1.put(“Sensor1”,Sensor1_data.get(j).toString());
person1.put(“Sensor2”,Sensor2_data.get(j).toString());
person1.put(“Sensor3”,Sensor3_data.get(j).toString());
person1.put(“Sensor4”,Sensor4_data.get(j).toString());
person1.put(“Sensor5”,Sensor5_data.get(j).toString());
person1.put(“Sensor6”,Sensor6_data.get(j).toString());
person1.put(“PersonName”,“John”);

    persons.create(person1);
}

updateButton.setEnabled(true);

}as i am inserting multiple data create option is not taking.

The code you showed saves only one object.

Also, the code uses the blocking API. Are you calling the API in a separate thread? (because blocking API is not allowed on the main thread in Android)

Backendless.Data.of( “Person” ).create( persons, new AsyncCallback<Void>()
{
@Override
public void handleResponse( Void response )
{
Log.i( “MYAPP”, “Objects have been saved” );
}

@Override
public void handleFault( BackendlessFault fault )
{
Log.i( “MYAPP”, "Server reported an error " + fault );
}
} );
i want to create multiple objects in multiple rows in single response but its not working.

You need to use bulkCreate method to create multiple objects in one call. See docs: https://backendless.com/docs/android/doc.html#data_multiple_objects_bulk_create

Regarding Please show how to write the code for this.
Unfortunately this is out of our free support policy
Regards Anton

Actually i did the exactlty same thing but it shows error as i mentioned above.

Oh, I’m sorry. Wrong description in docs. Change your code to be like this:

List&lt;Map&gt; persons = new ArrayList&lt;&gt;();


Map&lt;String, Object&gt; person1 = new HashMap&lt;&gt;();
person1.put( "age", 24 );
person1.put( "name", "Joe" );
persons.add( person1 );


Map&lt;String, Object&gt; person2 = new HashMap&lt;&gt;();
person2.put( "age", 34 );
person2.put( "name", "Betty" );
persons.add( person2 );


Backendless.Data.of( "Person" ).create( persons, new AsyncCallback&lt;List&lt;String&gt;>()
{
    @Override
    public void handleResponse( List&lt;String&gt; response )
    {
        System.out.println("Works");
    }


    @Override
    public void handleFault( BackendlessFault fault )
    {
        System.out.println("Not working");
    }
} );

Persons list - List<Map>
Callback - List<String> instead of Void

Sorry for inconvenience, we’ll make changes in docs asap

Anton

That was very helpful… thank you so much. :slight_smile: