4

my question is how do I take a screenshot using the built in screen capture. Any hints or sample code would be greatly appreciated.

Nisha
  • 132
  • 1
  • 7
  • Programmatically you want screenshot in android. please see this http://stackoverflow.com/questions/2661536/how-to-programatically-take-a-screenshot-on-android – harikrishnan Jun 04 '13 at 10:14

2 Answers2

13

There are two ways you can try,

  • Using Eclipse

Open the Devices view in Eclipse ( Window Menu --> Show View Option --> Other, Android --> Devices), and there's a toolbar button on the right side labeled Screen Capture

  • Using Android Code

    Bitmap bitmap;
    View v1 = MyView.getRootView();
    v1.setDrawingCacheEnabled(true);
    bitmap = Bitmap.createBitmap(v1.getDrawingCache());
    v1.setDrawingCacheEnabled(false);
    
Krish
  • 437
  • 4
  • 14
  • 3
    then you should accept the answer by tick marking on tick mark, which is on the rightside of my answer. so it can be useful for others. – Krish Mar 26 '12 at 08:37
  • @Krish I had tried to implement the given codes of lines but it is throwing exception on third line why it is so – Nikhil Singh Mar 09 '16 at 11:09
2

Click on DDMS select emulator from left side and then click on Camera icon.. and then save into your pc..

RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166