Android : How can i get a image that is in drawable its size in KB, name and extension
问题 I have a pic in res/drawable-hpdi/pic.jpg, then i have a alert box that should display the image height width size name and extension, i just cant figure out how to get it act like a file and get its size etc. Bitmap bMap = BitmapFactory.decodeResource(getResources(), R.drawable.pic); File file=new File("res/drawable-hdpi/pic.jpg"); long length = file.length(); if (!file.exists()) { length = -1; } imgInfo = "Height: " + bMap.getWidth() + "\n" + "Width: " + bMap.getHeight() + "\n" +"Size: " +