Android : How can i get a image that is in drawable its size in KB, name and extension -


I have a picture in res / drawable-hpdi / pic.jpg, so I have a warning box Should display height-width name and extension, I can not just understand how to work as a file and get its size etc.

  Bitmap beeppaint = BitMapficht. Decode processing (getResources (), R.drawable .pic); File file = new file ("res / drawable-hdpi / pic.jpg"); Long length = file. Long (); If (! File.exists ()) {length = -1; } ImgInfo = "Height:" + bMap.getWidth () + "\ n" + "Width:" + bMap.getHeight () + "\ n" + "Size:" + Length;   

I get height and width which can comfort me, can someone help me?

  byteoutputstream baoos = new byteOnputstream (); FileOutputStream fo = null; BMap.compress (Bitmap Compoformat.JPEG, 40, Baoos); File dst = new file (photoname + ".jpg"); Try {dst.createNewFile (); // Write bytes in the Fight = New File OptimizeTream (DST); Fo.write (baos.toByteArray ()); } Grip (IOE EXPRESS E) {LogE ("Photo Convert", "Error creating file: Check:" + DST, E); }   

After that, you will be able to check the file DST size and other items, hope it will help you

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

c# - Confused over DLL entry points (entry point not found exception) -