Android Java: bitmap resize define height and width auto -
i setimagebitmap
url imageview. want define height, , want app set width automatically, proportionally.
this code:
url imageurl = new url("url"); httpurlconnection connection = (httpurlconnection) imageurl.openconnection(); inputstream inputstream = connection.getinputstream(); bitmap = bitmapfactory.decodestream(inputstream); image_projet.setimagebitmap(bitmap);
float aspect = bitmap.getwidth() / (float) bitmap.getheight() int newwidth = newheight * aspect;
you can calculate new width.
Comments
Post a Comment