You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, I was testing my application that uses a custom layout (with imageview inside) and I found out as soon as I scroll in listview, the listview lags then the image appears. Why? Is this an expected behaviour from imageloader when i'm loading images from a database? I am using almost the same code from LazyList.
Here is my code:
SamsungListView offlineadapter = new SamsungListView(ctx, c);
listview.setAdapter(offlineadapter);
SamsungListView Class:
public class SamsungListView extends CursorAdapter {
public com.androidarabia.lazylist.ImageLoader imageLoader;
LayoutInflater mLayoutInflater;
Cursor curs;
LebanonDatabase DbHelper;
ViewHolder holder;
public SamsungListView(Context context, Cursor c) {
super(context, c);
curs = c;
mLayoutInflater = LayoutInflater.from(context);
imageLoader = new com.androidarabia.lazylist.ImageLoader(
context.getApplicationContext());
DbHelper = new LebanonDatabase(context).open();
holder = new ViewHolder();
}
static class ViewHolder {
TextView title_text;
TextView date_text;
ImageView item_image;
TextView del_image;
}
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View v = mLayoutInflater.inflate(R.layout.pricelist, parent, false);
return v;
}
@Override
public void bindView(View v, Context context, Cursor c) {
holder.title_text = (TextView) v.findViewById(R.id.title);
holder.date_text = (TextView) v.findViewById(R.id.modelnumber);
holder.item_image = (ImageView) v.findViewById(R.id.list_image);
holder.del_image = (TextView) v.findViewById(R.id.details);
final String title = c.getString(c
.getColumnIndex(LebanonDatabase.KEY_PHONENAME));
final String date = c.getString(c
.getColumnIndex(LebanonDatabase.KEY_MODELNUMBER));
final String imagePath = c.getString(c
.getColumnIndex(LebanonDatabase.KEY_PRICE));
final String deletion = c.getString(c
.getColumnIndex(LebanonDatabase.KEY_URL));
imageLoader.DisplayImage(deletion, holder.item_image);
holder.title_text.setText(title);
holder.del_image.setText(imagePath + " $");
holder.date_text.setText(date);
}
Any suggestions? the listview sees some hiccups when i'm scrolling first time, but at second time everything is smooth.
i posted a topic on Stackoverflow http://goo.gl/T46dQO
Thank you for your time! this is the best repository for Android ever!
The text was updated successfully, but these errors were encountered:
Today, I was testing my application that uses a custom layout (with imageview inside) and I found out as soon as I scroll in listview, the listview lags then the image appears. Why? Is this an expected behaviour from imageloader when i'm loading images from a database? I am using almost the same code from LazyList.
Here is my code:
SamsungListView offlineadapter = new SamsungListView(ctx, c);
listview.setAdapter(offlineadapter);
SamsungListView Class:
public class SamsungListView extends CursorAdapter {
Any suggestions? the listview sees some hiccups when i'm scrolling first time, but at second time everything is smooth.
i posted a topic on Stackoverflow http://goo.gl/T46dQO
Thank you for your time! this is the best repository for Android ever!
The text was updated successfully, but these errors were encountered: