currently i m working in drawable images in android, and now i want to get the size the drawable image in KB , how can i get it, any ideas are welcome.
Here i m getting the default application icons and storing in an drawable array, is creating a new file for each icon for getting length is a good idea? Please suggest any better idea,thanks
I think u have to make it a file. But not sure whether it works
File root = new File(Environment.getExternalStorageDirectory()
+ File.separator + "temp" + File.separator);
root.mkdirs();
File file= new File(root, "temp.png");
FileOutputStream fOut = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 100, fOut);//bmp is bitmap of ur image
fOut.flush();
fOut.close();
Using file.length()
should give you the file size.