Java

LinearLayoutv=(LinearLayout)findViewById(R.id.YourLayoutThatContainsEverything);if(v!=null){v.setDrawingCacheEnabled(true);Bitmapbmp=v.getDrawingCache();try{FileOutputStreamout=newFileOutputStream(Environment.getExternalStorageDirectory()+"Test.jpg");bmp.compress(Bitmap.CompressFormat.JPEG,90,out);}catch(FileNotFoundExceptione){// TODO Auto-generated catch blocke.printStackTrace();}}elseToast.makeText(this,"View not available in this activity",Toast.LENGTH_LONG);