lundi 30 mars 2015

zoom an image view on click - android

I just want your help on a simple matter,


I have an activity (android application) that includes three tabs showing information. In one of those tabs, i have an image view. The picture is loaded through an async task because i have to retrieve the picture from the database.


Anyway i want to zoom in on the image when i click on it. Anyone got a good tutorial for it? Because i have to write the code inside the async task of the fragment tab.





class AsyncCallWS3 extends AsyncTask<String, Void, String> {

ImageView img;
Context context;
boolean check;
Bitmap bm = null;

public AsyncCallWS3(ImageView img,Context context) {
// TODO Auto-generated constructor stub
this.img = img;
this.context = context;
}

@Override
protected String doInBackground(String... params) {
String result;
result = SponsorWebService.getSponsor("getDetails", "abed", "kader");
this.Execute();
return result;
}

protected void Execute(){
String result;
byte[] byteArray;
result = ImageService.getImage("ralph", "kesrouani","getImage");

byteArray = Base64.decode(result);

bm = BitmapFactory.decodeByteArray(byteArray,0,byteArray.length);

Bitmap resized = Bitmap.createScaledBitmap(bm, 60, 70, true);
img.setImageBitmap(resized);

img.setOnClickListener(new OnClickListener() {


}
});
}
}



Aucun commentaire:

Enregistrer un commentaire