Android Tutorial How to make screenshots!

Discussion in 'Tutorials & Examples' started by magarcan, Jul 12, 2011.

  1. magarcan

    magarcan Active Member Licensed User

    I think one of the easiest way is using Android SDK tools. I'll explain this method using Windows, but in Linux or Mac should be similar. This is what you have to do:
    -Connect your mobile to computer with usb cable

    -Open your SDK folder.

    -Go to tools folder
    -Execute ddms.bat
    -Your Device must be Online

    -Go to Device>Screen capture... or press Ctrl-S

    -Press Refresh in order to update your Screenshot.
    -Press Save to save your Screenshot.
    vecino likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Great tutorial. I will add a small tip.

    Here is an excellent open source screen capture program: zscreen - Advanced Image/Text/File utility that allows for region/window/full-screen screenshots, text services and file hosting - Google Project Hosting
    It allows you to select parts of the screen and it has many useful features. For examples I've configured it to automatically upload every image taken to this server. This way it is very easy for me to take a screenshot and then reference it here.
  3. okee

    okee New Member Licensed User

    Does that mean that there is no way of taking a screenshot from within an android phone ?
  4. magarcan

    magarcan Active Member Licensed User

    The only way is using a third party app, and a rooted phone...
  5. moster67

    moster67 Expert Licensed User

  6. Erel

    Erel Administrator Staff Member Licensed User

    It only allows you to take a screenshot after the device was connected with ADB (USB debugging). In most cases it will not be more useful than taking a screenshot with DDMS.
  7. moster67

    moster67 Expert Licensed User

    Ok, what a shame though...
  8. agraham

    agraham Expert Licensed User

    You can get a sort of screenshot with the Reflection library, but only from within the displayed Basic4android Activity
    Sub Btn1_Click
    Dim Obj1, Obj2 As Reflector
    Dim bmp As Bitmap
    Dim c As Canvas
       Obj1.Target = Obj1.GetActivityBA
       Obj1.Target = Obj1.GetField(
    Activity.Width, Activity.Height)
    Dim args(1As Object
    Dim types(1As String
       Obj2.Target = c
       Obj2.Target = Obj2.GetField(
    0) = Obj2.Target
    0) = ""
    "draw", args, types) 
    Dim Out As OutputStream
       Out = 
    File.OpenOutput(File.DirRootExternal, "Test.png"False)
    End Sub
    koaunglay and hibrid0 like this.
  9. moster67

    moster67 Expert Licensed User

    Tried it and it worked nicely. I am sure that code-snippet can become handy sooner or later.

    Thanks! :sign0142:

  10. francoisg

    francoisg Active Member Licensed User

    Also see the MyPhoneExplorer utility (phone management app) - search for it using google - it has the ability to show screenshots (even automatically updated) - you can basically see the live android screen on your windows desktop (no root required!)
    It is freeware but you can donate to the author if you like his work (which I obviously do ;-)

    Would really like to know how he did it!
  11. agraham

    agraham Expert Licensed User

    As the USB connection needs USB debugging enabled on the phone and the adb driver installed on the PC it looks like he is using the connection to the adb daemon on the phone in the same way as ddms can get a screenshot from a non-rooted phone.
  12. Penko

    Penko Active Member Licensed User

    Using the code above throws a "FileNotFound" exception.

    The only change I've made is that my FileName is name & ".png" where name = Datetime.Now.

    Isn't it true that the file will be created in case it doesn't exist?
  13. BarrySumpter

    BarrySumpter Active Member Licensed User

    I've downloaded MyPhoneExplorer and installed on HD2 and pc.
    Don't see anything about snapshots.
  14. Mahares

    Mahares Well Known Member Licensed User

    1. To see screenshots of your device, when launched, MyPhoneExplorer will display a horizontal bar menu: 'File', View', 'Extra'. (With phone connected to PC).
    2. Select 'Extra'
    3. Select 'Phone Keypad'. You should see your device screen on the PC monitor.
    4. Click 'Automatic refresh' to display the device screen as it changes.
    It works well. I wish it had a feature that allows you to record the screenshots in the background to a file as you pan your application.
  15. alfcen

    alfcen Well-Known Member Licensed User

    Press the Home key and the power switch simultaneously to save the screen to SD.
    Requires Android 2.2 and higher. Not sure whether this works with all phone devices.
  16. BarrySumpter

    BarrySumpter Active Member Licensed User

    FJ Software :: Thema anzeigen - Howto and FAQ: Use Android Phones with MyPhoneExplorer
  17. madSac

    madSac Active Member Licensed User

    I am getting following error
    ** Activity (main) Resume **

    Activity (main) Create, isFirst = true **

    main_activity_create (java line: 

    java.lang.NoSuchFieldError: anywheresoftware.b4a.BA.activityBA

       at anywheresoftware.b4a.agraham.reflection.Reflection.GetActivityBA(
       at madsacsoft.maddev.main._activity_create(
       at java.lang.reflect.Method.invokeNative(Native Method)
  18. Erel

    Erel Administrator Staff Member Licensed User

    Update your Reflection library to the latest version.
  19. madSac

    madSac Active Member Licensed User

    Oh.I updated it
    I tried to capture screen shot using service.It gave me error.But when I use it in activity it works fine.this restrict me to my application only.Is there any method by which I can get screenshot using service ?

    root access (rooting) is can also be provided if needed
  20. Erel

    Erel Administrator Staff Member Licensed User

    You cannot take screenshots of other applications. On some rooted devices there are all kinds of workarounds. Search google for more information. I haven't tried any of them.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice