0

Hi all Stack Overflow members,

I have written native Java code to capture a screen shot of the desktop. It uses the following libraries; are these libraries allowed in Android? If not, what should I do to take screen shots in Android?

javax.swing.*;
javax.imageio.*;
java.awt.*;
java.awt.event.*;
java.awt.image.*;
java.awt.AWTException;
java.awt.Robot;
java.awt.Rectangle;
java.awt.Toolkit;
java.awt.image.BufferedImage;
Adam Paynter
  • 46,244
  • 33
  • 149
  • 164
manju
  • 847
  • 3
  • 16
  • 43
  • 1
    `I have written a native java code to capture screen of desktop.` native code is OS specific. – jmj Dec 10 '10 at 07:25
  • See http://stackoverflow.com/questions/3067586/how-to-capture-the-android-device-screen-content – Jon Skeet Dec 10 '10 at 07:28

3 Answers3

1

No, some of these are not available on android. Swing is not available, for instance.

For a full listing, check the api docs here: http://developer.android.com/reference/packages.html

There's already a question on SO about capturing the screen that you can check out: How to capture the android device screen content?

Community
  • 1
  • 1
Joeri Hendrickx
  • 16,947
  • 4
  • 41
  • 53
  • hi the second link which you have given is not giving the download option it is throwing some error wen i press download button over there – manju Dec 10 '10 at 09:23
  • @manju which are you talking about? Neither or those likes offer to download something. – Joeri Hendrickx Dec 10 '10 at 09:47
  • i went through the 2nd link which you have given to me...in that there is option to download the android screen shot app,but it is giving some error upon click on download button.. – manju Dec 10 '10 at 09:54
  • Indeed it is. But there's many other interesting answers in that question. – Joeri Hendrickx Dec 10 '10 at 10:41
0

For java.awt.Rectangle, i'm able to resolve it by clicking on "Fix project setup..." in eclipse error fix suggestion. I think you need to check if Java JDK is in the library of your android project under /libs folder.

Hope it helps.

CheeHow
  • 875
  • 4
  • 12
  • 27
0

Basically what android does is it transforms .class files to .dex file. If your jar file (classes) is compatible with Dalvik VM of android, that jar will be supported in android. If not, then you have to take source code of that jar file and replace the classes (with android supported class) which are not compatible to Dalvik VM. It is possible that you wan't find replacement for all classes.

Valery Viktorovsky
  • 6,487
  • 3
  • 39
  • 47
Nikunj
  • 3,100
  • 2
  • 20
  • 19