java - Zooming a view - not from drawable -


hi , thank in advance.

i trying create onclick zoom animation image in imageview.

i working example here android developer.

which works great..and looking for. however, image expands seems come drawable folder.

the picture want expanded created user, via camera, , stored in application folder.

this how call picture , set imageview use:

contextwrapper cw = new contextwrapper(getapplicationcontext());     file directory = cw.getdir("imagedir", context.mode_private);     final file mypath=new file(directory,"pic_"+filename+".jpg");     loadimagefromstorage(mypath.tostring());   private void loadimagefromstorage(string path) {      try {         file f=new file(path);         bitmap b = bitmapfactory.decodestream(new fileinputstream(f));         imageview img=(imageview)findviewbyid(r.id.imageview7);         img.setimagebitmap(b);     }     catch (filenotfoundexception e)     {         e.printstacktrace();     }  } 

and here relevant portion of android developer example:

 final view thumb1view = findviewbyid(r.id.thumb_button_1);     thumb1view.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             zoomimagefromthumb(thumb1view, r.drawable.image1);         }     });  private void zoomimagefromthumb(final view thumbview, int imageresid) {     // if there's animation in progress, cancel     // , proceed one.     if (mcurrentanimator != null) {         mcurrentanimator.cancel();     }      // load high-resolution "zoomed-in" image.     final imageview expandedimageview = (imageview) findviewbyid(             r.id.expanded_image);     expandedimageview.setimageresource(imageresid); 

as can see "imageresid" comes r.drawable.image1

i know animation working fine...because can save example drawable , test it.

however...i dont know how work image in imageview.

i tried couple of things...like changing android developer example expandimageview.setimagebitmap(b) instead of expandimageview.setimageresource()

and bitmap load...and animation...and expanded picture...but image quality poor, assume caused original compression, although under impression .png made loss less.

which did this:

try {                 fos = new fileoutputstream(mypath);                 imagebitmap.compress(bitmap.compressformat.png, 100, fos);                 fos.close();             } catch (exception e) {                 e.printstacktrace();             } 

i still new designing in android, , believe there easy way after. thank in advance.

edit - 1/21/16

well...since no 1 answering. thought add comment...that after doing reading. bitmap returns thumbnail. im expanding thumbnail, no matter quality.

im going have try different root picture. tried example in android developer...and didnt work. camera never intialized.

what take picture...save file, not sd card, , not users media gallery, private folder. able call image activity, imageview. if has advise, appreciate it.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -