public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  currentView = findViewById(R.id.screen);
  clickBtn = findViewById(R.id.click_button);
  clickBtn.setOnClickListener(this);
  }

  public void onClick(View v){
  View screen = currentView.getRootView();
  System.out.println("Root view");
  screen.setDrawingCacheEnabled(true);
  Bitmap shot = screen.getDrawingCache();
  if(shot != null)
  System.out.println("shot is not null");

  FileOutputStream fos = null;
  try {
  fos = new FileOutputStream(pathname);
  if(fos != null){
  shot.compress(Bitmap.CompressFormat.PNG, 100, fos);
  fos.flush();
  fos.close();
  }
  }catch (FileNotFoundException e){
  e.printStatckTrace();
  }catch (IOException e){
  e.printStatckTrace();
  }
  }

 


http://code.neenbedankt.com/how-to-render-an-android-view-to-a-bitmap

http://stackoverflow.com/questions/6895230/how-to-display-image-in-mail-on-android

http://www.anddev.org/other-coding-problems-f5/how-to-capture-screen-with-coding-t3755.html