New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when loadImage into RemoteViewsFactory #199
Comments
It seems |
sorry but http://prntscr.com/vgrvr
|
http://prntscr.com/vihda |
I think you need synchronous image loading. final Object lock = new Object();
boolean loaded = false;
ImageSize targetImageSize = new ImageSize(70, 70);
ImageLoader.getInstance().loadImage(imageUri, targetImageSize, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
loaded = true;
// Do whatever you want with loadedImage
synchronize(lock) {
lock.notifyAll();
}
}
});
if (!loaded) {
synchronize(lock) {
lock.wait();
}
} Remove all your code about |
http://prntscr.com/vilop
|
Ok, try with Looper. |
http://prntscr.com/vip66 one call getViewAt(...) and missing call complete or failed |
http://prntscr.com/vtr1a |
It would be better you send me your project (if you can). So I can play with it to search the solution. |
please write your skype |
Write me on email - nostra13[at]gmail[dot]com |
Any luck on this? I'm wanting to do the same thing... |
I've fixed it. See code: Map<Integer, Boolean> flags = Collections.synchronizedMap(new HashMap<Integer, Boolean>());
Bitmap mBitmap;
Handler handler = new Handler(Looper.getMainLooper());
@Override
public RemoteViews getViewAt(final int position) {
flags.put(position, false);
handler.post(new Runnable() {
@Override
public void run() {
ImageLoader.getInstance().loadImage(item.getImageUrl(), new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
flags.put(position, true);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
flags.put(position, true);
}
@Override
public void onLoadingComplete(String arg0, View arg1, Bitmap bitmap) {
mBitmap = bitmap;
flags.put(position, true);
}
});
}
});
while (!flags.get(position)) {
Thread.sleep(200l);
}
flags.put(position, false);
if (mBitmap != null) {
row.setImageViewBitmap(R.id.icon, mBitmap);
} else {
row.setImageViewResource(R.id.icon, R.drawable.bg_cover);
}
mBitmap = null;
flags.put(position, false);
handler.post(new Runnable() {
@Override
public void run() {
ImageLoader.getInstance().loadImage(item.getImageUrl(), new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
flags.put(position, true);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
flags.put(position, true);
}
@Override
public void onLoadingComplete(String arg0, View arg1, Bitmap bitmap) {
mBitmap = bitmap;
flags.put(position, true);
}
});
}
});
while (!flags.get(position)) {
Thread.sleep(200l);
}
flags.put(position, false);
if (mBitmap != null) {
row.setImageViewBitmap(R.id.icon, mBitmap);
} else {
row.setImageViewResource(R.id.icon, R.drawable.bg_cover);
}
mBitmap = null;
} |
ÉÌÉ Ñ ÐÕÔÁÀÓØ ÉÌÉ ÔÕÔ ÉÄ£Ô 2 ÒÁÚÁ ÐÏÄÒÑÄ ÏÄÉÎÁËÏ×ÙÊ ËÏÄ? 2013/5/21 Vova Klyshevich notifications@github.com
ëÏÒÎÉÅà äÍÉÔÒÉÊ |
@IstiN : Could you format your code a little and if not hassle could you please explain the logic behind. |
I think you can use sync methods of ImageLoader to display images now ( |
Does Vova's solution pre-dates loadImageSync? |
Yes, it does. |
thanks a lot |
bug http://prntscr.com/vez6f
it is listview factory for widget
ImageLoader work well into another activity
please help
The text was updated successfully, but these errors were encountered: