I want to know how to change storage location of captured picture. In my codes, captured picture means screenshot image
Variable SendingImage get Bitmap, and then i want storing screenshot at sdcard or somewhere. After store, i want get Uri about location of screenshot by String
Here is my code =
File sdCard = Environment.getExternalStorageDirectory();
String filename = "screenshot1.jpg";
ImageView GetImage = (ImageView) findViewById(R.id.show_heyboard);
GetImage.setDrawingCacheEnabled(true);
Bitmap SendingImage;
GetImage.buildDrawingCache();
SendingImage = GetImage.getDrawingCache();
Toast.makeText(getApplicationContext(), "1_is working", Toast.LENGTH_SHORT).show();
try{
File files = new File(sdCard.getAbsolutePath()+"/sdcard");
files.mkdirs();
File f = new File(files, "screaanshot1");
FileOutputStream outStream = new FileOutputStream(f);
SendingImage.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.close();
} catch(IOException e){
e.printStackTrace();
}
GetImage.setDrawingCacheEnabled(false);
If there is way to get preview of screenshot, Please tell me!!
Thanks :)
I want to know how to change storage location of captured picture
You wrote the code that specifies the storage location:
File files = new File(sdCard.getAbsolutePath()+"/sdcard");
files.mkdirs();
File f = new File(files, "screaanshot1");
You are welcome to change that code to something else that suits your needs.
If there is way to get preview of screenshot
Use an image-loading library, like Picasso, to load your image into an ImageView
.