The Andengine engine provides a class of screencapture
Usage of this class: Screencapture cap= new Screencapture (), non-parametric constructor
And then add it to the scene, and if you don't add it to the scene, you can't intercept any data.
She has two main methods.
Capture (final int pcapturewidth, final int pcaptureheight, final String pfilepath, final iscreencapturecallback Pscreenca Pturecallback)
and capture (final int pcapturex, final int pcapturey, final int pcapturewidth, final int pcaptureheight, final String Pfilep Ath, final iscreencapturecallback pscreencapturecallback)
The Pscreencapturecallback callback interface is called after a success or failure.
Use out = new FileOutputStream (Pfilepath);
Pbitmap.compress (Compressformat.png, N, out);
And there's Andengine's ***activity. There's a way runrunonuithread (runnable) can do some UI action in a non-UI thread, such as a non-UI thread that can't use toast,
But the Runrunonuithread method can be used
For example:
CaptureSampleActivity.this.runOnUiThread (New Runnable () {
@Override
public void Run () {
Toast.maketext (Getapplication (), "Success", Toast.length_long). Show ();
}
});
The screencapture of Andengine