2012-08-07 79 views
0

这里是我的代码。无法捕捉AndEngine中的屏幕截图

public static void TakeScreenShot(String FileName) 
{ 
     Log.d("Screen"," Path "+ FileName); 

     scr.capture(CAMERA_WIDTH, CAMERA_HEIGHT, FileName, new IScreenCaptureCallback() { 
      @Override 
      public void onScreenCaptured(final String pFilePath) { 
       Log.d("Screen","Yes "+ pFilePath); 

      } 

      @Override 
      public void onScreenCaptureFailed(final String pFilePath, final Exception pException) { 
       Log.d("Screen","NO "+ pFilePath+" "+pException); 

      } 
     }); 
    } 

第一个日志工作正常。但是没有其他日志正在工作。 它没有完成也没有失败。 任何人都可以给我一个解决方案吗?

我在哪里保存路径是 “/mnt/sdcard/cmtdd.png”

回答

1

的follwing可能work..I添加scene.attachChild(抓屏);到你的代码。它应该在正确的地方使用。

public static void TakeScreenShot(String FileName) 
{ 
     Log.d("Screen"," Path "+ FileName); 

     scene.attachChild(screenCapture); // Attaching screen capture after all rendered. 

     scr.capture(CAMERA_WIDTH, CAMERA_HEIGHT, FileName, new IScreenCaptureCallback() { 
      @Override 
      public void onScreenCaptured(final String pFilePath) { 
       Log.d("Screen","Yes "+ pFilePath); 

      } 

      @Override 
      public void onScreenCaptureFailed(final String pFilePath, final Exception pException) { 
       Log.d("Screen","NO "+ pFilePath+" "+pException); 

      } 
     }); 
    } 
+0

oo是的我忘了将屏幕捕获附加到场景。 Thanks.SOLVED .. – 2012-10-02 07:15:11