I am trying to make an app which can generate an image file(JPEG/PNG) with dimensions equal to the user's phone's screen size and fill it with a single solid color(BLACK/BLUE/GRAY, etc). After generating it, it should save the image to the external storage to be used in any other app. Any help would be appreciated. So far I have been able to do this based on a few answers but it doesn't generate any image file. (I have given the permission to write in External Storage)
Bitmap bmp = Bitmap.createBitmap(640, 480, Bitmap.Config.ARGB_8888);//MUTABLE bitmap
File file = new File(Environment.getExternalStorageDirectory(),"/image" + System.currentTimeMillis() + ".png");
FileOutputStream str;
try {
str = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG,100,str);
}
catch (IOException e) {
e.printStackTrace();
}
This was just an attempt to check whether any image would be generated/stored or not.