I am using the following custom widget to async image loading from web...
i am dispalying images in listview when i scrool down in speed it throws
RejectedExecutionException exception
any idea ?
public class WebImage extends ImageView {
private final static String TAG = SearchTitleResults.class.getSimpleName();
public WebImage(Context context) {
super(context);
}
public WebImage(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public WebImage(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public synchronized void reset(){
setImageResource(R.drawable.water2);
}
public synchronized void loadImage(String imageURL){
class DownloadImageTask extends AsyncTask {
String url = "";
@Override
protected Object doInBackground(Object... arg0) {
url = arg0[0].toString();
Log.v(TAG, "doInbackground: " + url);
Bitmap bmp = WebServiceRequest.getInstance().getImageFromURL(url);
return bmp;
}
@Override
protected void onPostExecute(Object result) {
super.onPostExecute(result);
setImageBitmap((Bitmap)result);
Log.v(TAG, "Post() -> " + url);
}
}
new DownloadImageTask().execute(imageURL);
}
}
i am dispalying images in listview when i scrool down in speed it throws
RejectedExecutionException exception
any idea ?
public class WebImage extends ImageView {
private final static String TAG = SearchTitleResults.class.getSimpleName();
public WebImage(Context context) {
super(context);
}
public WebImage(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public WebImage(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public synchronized void reset(){
setImageResource(R.drawable.water2);
}
public synchronized void loadImage(String imageURL){
class DownloadImageTask extends AsyncTask {
String url = "";
@Override
protected Object doInBackground(Object... arg0) {
url = arg0[0].toString();
Log.v(TAG, "doInbackground: " + url);
Bitmap bmp = WebServiceRequest.getInstance().getImageFromURL(url);
return bmp;
}
@Override
protected void onPostExecute(Object result) {
super.onPostExecute(result);
setImageBitmap((Bitmap)result);
Log.v(TAG, "Post() -> " + url);
}
}
new DownloadImageTask().execute(imageURL);
}
}