I'm trying to get data from databse in a listview as shown below.
long count = UserTableSugar.count(UserTableSugar.class);
if(count>0)
{
UserTableSugar.listAll(UserTableSugar.class);
List<UserTableSugar> userTable = UserTableSugar.listAll(UserTableSugar.class);
CustomAdapterListview madapter = new CustomAdapterListview(getApplicationContext(),userTable);
listView.setAdapter(madapter);
}
but,the data won't show up. On debugging, the value of count is 2 (there are two records in table). But the size of list userTable is shown 0.
SOLVED : Adding empty constructor of the model class did the trick.