write a code in a separate threads
Hello how can i write this code in a separate threads because i have an
intensive operations in my main thread.so i have to use an Async Activity
and delegate the network intensive operation to 'doInBackground'
method.but i don't know how to edit it
public void setImage(ImageView aView, URL aURL) {
try {
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
// Bufferisation pour le t�l�chargement
BufferedInputStream bis = new BufferedInputStream(is, 8192);
// Cr�ation de l'image depuis le flux des
donn�es entrant
Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
// Fixe l'image sur le composant ImageView
aView.setImageBitmap(bm);
} catch (IOException e) {
aView.setImageDrawable(mNoImage);
Log.e("DVP Gallery", "Erreur t�l�chargement
image URL : " + aURL.toString());
e.printStackTrace();
}
}
please help me thanks
No comments:
Post a Comment