1) write a following code in your .java file
Const.java
public static boolean isLoadImage;
ImageList.java
public class ImageList extends Activity
{
private ImageLoader imageLoader;
private static Activity _Caller;
int imageLoderMode = 1;
@Override
protected void onCreate(Bundle savedInstanceState)
{
_Caller=this;
Constants.isLoadImage = true;
loadimage = new LoadThumbnail(ImageView(ex img), imageLoderMode);
loadimage.execute(int idof image(ex.photoID));
if(imageLoderMode == 3)
imageLoderMode = 0;
imageLoderMode++;
}
}
//=====================ImageLoder======================================
public class LoadThumbnail extends AsyncTask<String, String, Bitmap>
{
public ImageView image;
private int Mode;
private LoadThumbnail(final ImageView image, int mode)
{
this.image = image;
this.Mode = mode;
}
protected void onPreExecute()
{
}
protected Bitmap doInBackground(String... param)
{
Bitmap viewBitmap = null;
try
{
if(!Constants.isLoadImage)
return null;
try{
if(Mode == 1)
viewBitmap = getThumbnail_1(param[0]);
else if(Mode == 2)
viewBitmap = getThumbnail_2(param[0]);
else if(Mode == 3)
viewBitmap = getThumbnail_3(param[0]);
} catch (Exception e) {
// Log.error(this.getClass() + " getThumbnail :: ", e);
viewBitmap = null;
}
}
catch (OutOfMemoryError e)
{
viewBitmap = null;
}
catch (Exception e)
{
//Log.error(this.getClass() + " LoadThumbnail :: ", e);
viewBitmap = null;
}
return viewBitmap;
}
protected void onPostExecute(Bitmap bitmap)
{
if (bitmap != null)
{
this.image.setImageBitmap(bitmap);
}
}
}
public static synchronized Bitmap getThumbnail_1(String thumName)
{
return new Utils().getThumbnailMain(_Caller, thumName);
public static synchronized Bitmap getThumbnail_2(String thumName)
{
return new Utils().getThumbnailMain(_Caller, thumName);
}
public static synchronized Bitmap getThumbnail_3(String thumName)
{
return new Utils().getThumbnailMain(_Caller, thumName);
}
Const.java
public static boolean isLoadImage;
ImageList.java
public class ImageList extends Activity
{
private ImageLoader imageLoader;
private static Activity _Caller;
int imageLoderMode = 1;
@Override
protected void onCreate(Bundle savedInstanceState)
{
_Caller=this;
Constants.isLoadImage = true;
loadimage = new LoadThumbnail(ImageView(ex img), imageLoderMode);
loadimage.execute(int idof image(ex.photoID));
if(imageLoderMode == 3)
imageLoderMode = 0;
imageLoderMode++;
}
}
//=====================ImageLoder======================================
public class LoadThumbnail extends AsyncTask<String, String, Bitmap>
{
public ImageView image;
private int Mode;
private LoadThumbnail(final ImageView image, int mode)
{
this.image = image;
this.Mode = mode;
}
protected void onPreExecute()
{
}
protected Bitmap doInBackground(String... param)
{
Bitmap viewBitmap = null;
try
{
if(!Constants.isLoadImage)
return null;
try{
if(Mode == 1)
viewBitmap = getThumbnail_1(param[0]);
else if(Mode == 2)
viewBitmap = getThumbnail_2(param[0]);
else if(Mode == 3)
viewBitmap = getThumbnail_3(param[0]);
} catch (Exception e) {
// Log.error(this.getClass() + " getThumbnail :: ", e);
viewBitmap = null;
}
}
catch (OutOfMemoryError e)
{
viewBitmap = null;
}
catch (Exception e)
{
//Log.error(this.getClass() + " LoadThumbnail :: ", e);
viewBitmap = null;
}
return viewBitmap;
}
protected void onPostExecute(Bitmap bitmap)
{
if (bitmap != null)
{
this.image.setImageBitmap(bitmap);
}
}
}
public static synchronized Bitmap getThumbnail_1(String thumName)
{
return new Utils().getThumbnailMain(_Caller, thumName);
public static synchronized Bitmap getThumbnail_2(String thumName)
{
return new Utils().getThumbnailMain(_Caller, thumName);
}
public static synchronized Bitmap getThumbnail_3(String thumName)
{
return new Utils().getThumbnailMain(_Caller, thumName);
}
No comments:
Post a Comment