Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- String mPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" +"imagen.jpg";
- View v1 = getWindow().getDecorView().getRootView();
- v1.setDrawingCacheEnabled(true);
- Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());
- v1.setDrawingCacheEnabled(false);
- File nuevo = new File(mPath);
- FileOutputStream Salida = new FileOutputStream(nuevo);
- FileOutputStream Sa= new FileOutputStream(nuevo);
- int quality = 100;
- bitmap.compress(Bitmap.CompressFormat.JPEG, quality, Salida);
- Salida.flush();
- Toast.makeText(getApplicationContext(),"HECHO",Toast.LENGTH_SHORT).show();
- } catch (Throwable e) {
- Toast mal= Toast.makeText(getApplicationContext(),"Que mal rollo",Toast.LENGTH_SHORT);
- mal.show();
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement