Android Tutorial How to make screenshots!

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.
95133642.png


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


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


-Press Refresh in order to update your Screenshot.
-Press Save to save your Screenshot.
64727966.png
 

madSac

Active Member
Licensed User
Longtime 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.
Ok So there is no other way without rooting.
Fine.
Thank you.
 

yttrium

Active Member
Licensed User
Longtime 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.

This is actually wrong - you can easily take a screenshot of the current screen by invoking
B4X:
/system/bin/screencap -p /sdcard/screenshot.png
which outputs a screenshot of the current immediate screen to "screenshot.png" on the sdcard.

This method works in API14 and above without root being required, no matter the system, even if the device is running Sense or Touchwiz.
 

Laurent95

Active Member
Licensed User
Longtime User
You can get a sort of screenshot with the Reflection library, but only from within the displayed Basic4android Activity
B4X:
Sub Btn1_Click
   Dim Obj1, Obj2 As Reflector
   Dim bmp As Bitmap
   Dim c As Canvas
   Obj1.Target = Obj1.GetActivityBA
   Obj1.Target = Obj1.GetField("vg")
....../.....   
   bmp.WriteToStream(out, 100, "PNG")
   Out.Close
End Sub

Hello Agraham,

Very nice, that works fine :)
How i can get a screen shot from only an imageview of the activity ?
What i must change in this code, if it's possible of course.

Thanks for your help.

Regards
 

Laurent95

Active Member
Licensed User
Longtime User
It is much simpler. You can get the Bitmap with ImageView.Bitmap and then save it with Bitmap.WriteToStream.

Hi Erel,

Thank you for responding, but, oppppps, i have forget one thing.
I want to get a screen shot from an animate bitmap, who's animated by an external library.
And this solution can't work :)

Then of course i need to take the screen shot only for a part of the screen otherwise i still get a fixed drawing of the bitmap.

Regards.
 

priusfan

Member
Licensed User
Longtime User
hello
I use with success agraham's method.
but it does not work when using gmap: the panel with the map is blank...


here is the real thing:
scr2.png


and here is the screencapture:
scr1.png


any ideas about a solution?
 

me68

Member
Licensed User
Longtime User
If you press Home-Button & Power-Button simultan for 1 second a white rectangle is drawn on the Screen and a screenshot is stored at \Images\screenshots ...


file.php


It must be possible ...

Martin
 

priusfan

Member
Licensed User
Longtime User
@me68 (private joke)
hello Martin
icon_jap.gif

I remind you this application is made for an electric car...
Using one full hand for holding the phone/tablet and 2 fingers from the other one for taking a screenshot is a bit dangerous when driving.
icon_velo.gif


some details about this dev are here
me68 joined me on this dev and made it better & better.
 
Top