Closed GoogleCodeExporter closed 9 years ago
The problem with adding this functionality is that a security tag is needed in
the application under test that allows of saving the screenshot. So basically
anyone who wants to use Robotium must add that security permission tag to the
AndroidManifest.xml of the application under test. That is not something that
we can require all Robotium users to do. Thus we have not included this feature
into Robotium.
Original comment by renasr...@gmail.com
on 16 Oct 2010 at 2:34
I actually control the build of my app and I am thinking writing small piece of
code to do this.
Could you please point me to some code to do this.
Thanks a lot for quick updates.
Original comment by aman.bha...@gmail.com
on 16 Oct 2010 at 3:08
[deleted comment]
[deleted comment]
[deleted comment]
Hi there i know the answer what i am posting was too late but it would help
someone out there, i got the help form the link
http://softteco.blogspot.com/2011/04/android-take-screenshot.html
If you can't get to the link
just try the below code
// set your location
private static final String SCREEN_SHOTS_LOCATION = "/media/screenshots";
public static void takeScreenShot(View view, String name) throws Exception {
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap b = view.getDrawingCache();
FileOutputStream fos = null;
try {
File sddir = new File(SCREEN_SHOTS_LOCATION);
if (!sddir.exists()) {
sddir.mkdirs();
}
fos = new FileOutputStream(SCREEN_SHOTS_LOCATION + name + "_"
+ System.currentTimeMillis() + ".jpg");
if (fos != null) {
b.compress(Bitmap.CompressFormat.JPEG, 90, fos);
fos.close();
}
} catch (Exception e) {
}
}
Call:
Utils.takeScreenShot(solo.getViews().get(0), getName());
cheers
RanjithkumarRagavan
Enterprise Mobile Developer
ProkarmaSoftech pvt.lt
Chennai
Original comment by rranj...@prokarmasoftech.com
on 6 Jan 2012 at 11:18
Original issue reported on code.google.com by
aman.bha...@gmail.com
on 16 Oct 2010 at 2:16