2012-08-07 38 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