angel
(angel)
March 11, 2016, 10:23am
1
Hi ,
I try to fetch 50 records at a time from backendless table and i am not able to find all that in single query.
Currently i am doing this code :
Backendless.Data.of(History.class).find(dataQuery, new LoadingCallback<BackendlessCollection<History>>(getActivity(), "Loading...", true) {
@Override
public void handleResponse(BackendlessCollection<History> historyBackendlessCollection) {
// here i am getting record form server and try to add in arraylist but i get only 10 record in this list
listitem.addAll(historyBackendlessCollection.getCurrentPage());
super.handleResponse(historyBackendlessCollection);
}
});
here i am not able to get all record how to do these ?
Please help to solve this .
Add this code before you load any data:
QueryOptions queryOptions = new QueryOptions();
queryOptions.setPageSize( 50 );
dataQuery.setQueryOptions( queryOptions );
angel
(angel)
March 11, 2016, 10:56am
3
Ok ,
Thanks Mark ,
It’s work and helpful for me.
angel
(angel)
March 11, 2016, 11:04am
4
It is not possible to give pagesize > 100 ?
angel
(angel)
March 11, 2016, 11:13am
6
So if i want more than 100 then what i have to do ? Is there any other way to do that?
//this is my code i am unable to get more then 10 data in a row.
package com.example.kulwindersingh.kiit.Event_Details;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.backendless.Backendless;
import com.backendless.BackendlessCollection;
import com.backendless.async.callback.AsyncCallback;
import com.backendless.exceptions.BackendlessFault;
import com.backendless.persistence.BackendlessDataQuery;
import com.backendless.persistence.QueryOptions;
import com.example.kulwindersingh.kiit.R;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
/**
Created by hp on 8/24/2016.
*/
public class Ewc extends Activity {
ListView listView;
ArrayAdapter<String> adapter1;
ArrayList<String> course_list = new ArrayList<>();
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ewc1);
listView = (ListView) findViewById(R.id.listview);
Backendless.initApp(this, Defaults.APPLICATION_ID, Defaults.SECRET_KEY, Defaults.VERSION);
BackendlessDataQuery dataQuery = new BackendlessDataQuery();
QueryOptions queryOptions = new QueryOptions();
queryOptions.setPageSize( 90 );
dataQuery.setQueryOptions( queryOptions );
Backendless.Data.of(EastWestCenter.class).find(dataQuery, new AsyncCallback<BackendlessCollection<EastWestCenter>>() {
@Override
public void handleResponse(BackendlessCollection<EastWestCenter> eastWestCenterBackendlessCollection) {
for (EastWestCenter ewc : eastWestCenterBackendlessCollection.getData()) {
course_list.add(ewc.getSpokesperson() + "\n" + ewc.getAboutEvent());
Toast.makeText(Ewc.this, "" + ewc.getSpokesperson(), Toast.LENGTH_SHORT).show();
}
adapter1 = new ArrayAdapter<String>(getApplicationContext(), R.layout.contentfetch_layout, course_list);
listView.setAdapter(adapter1);
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
}
});
}
}