Hi every 1,
I’m trying backendless for the first time , i have an app which insert and retrieve contacts info,
my issue that my list view shows only 10 items (last 10 inserted items) while my DB has more then 20 !! ??
this my code to load the data
public void loaddata(){
if (contactslist !=null){ // if its has data we clear it to prevent duplicate data in case of refresh
contactslist.clear();
}
String condition = "useremail = '"+ getIntent().getStringExtra("UserEmail")+"'";
BackendlessDataQuery query= new BackendlessDataQuery();
query.setWhereClause(condition);
Backendless.Persistence.of(ContactsObject.class).find(query, new AsyncCallback<BackendlessCollection<ContactsObject>>() {
@Override
public void handleResponse(BackendlessCollection<ContactsObject> contactsObjectBackendlessCollection) {
contactslist=contactsObjectBackendlessCollection.getData(); // return list
ContactAdapter adapter= new ContactAdapter(Contacts.this,contactslist);
lvcontacts.setAdapter(adapter);
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast.makeText(Contacts.this, "Error "+backendlessFault, Toast.LENGTH_SHORT).show();
}
});
}
and this is my custom adapter
public class ContactAdapter extends ArrayAdapter<ContactsObject>{
private Context context;
private List<ContactsObject> contactslist;
public ContactAdapter(Context context, List<ContactsObject> list){
super(context,R.layout.ctninforow,list);
this.context=context;
this.contactslist=list;
}
public class ViewHolder{
TextView tvname,tvemail,tvphone;
public ViewHolder(View v){
TextView tvname=(TextView) v.findViewById(R.id.ctnname);
TextView tvemail=(TextView) v.findViewById(R.id.ctnemail);
TextView tvphone=(TextView) v.findViewById(R.id.ctnphone);
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder myholder=null;
if (convertView == null){
LayoutInflater inflater =(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.ctninforow,parent,false);
myholder=new ViewHolder(convertView);
convertView.setTag(myholder);
}else{
myholder =(ViewHolder) convertView.getTag();
}
myholder.tvname.setText(contactslist.get(position).getName());
myholder.tvemail.setText(contactslist.get(position).getEmail());
myholder.tvphone.setText(contactslist.get(position).getPhone());
return convertView;
}
}
i really don’t know what is wrong ,please any ideas will be much appreciated