2013-10-23 206 views
4

我已經好幾天尋找解決這個問題,我不知道該怎麼辦:(action_image_capture重新啓動應用程序

我有一個使用原生相機拍照的應用程序,但問題是,有時,只有在某些設備上,當我拍照並保存並返回,我的應用程序重新啓動。

它的webview如此之多的邏輯是在服務器端,但使用JavaScript接口處理本機功能,如相機。

它很難趕上,因爲它只發生在一些設備,即使他們是sa我有兩個銀河王牌,在一個幾乎總是發生,並在其他幾次(這些不是我測試的唯一設備)

我認爲這是相關的方向或相機像那樣。因爲似乎當我在旋轉保存/放棄屏的設備(拍照後)更經常發生

這是我的一些代碼:

清單:

 <activity 
     android:name="XXX" 
     android:configChanges="orientation|keyboardHidden|screenSize" 
     android:excludeFromRecents="false" 
     android:label="@string/XXX" 
     android:launchMode="singleTask" 
     android:taskAffinity="" 
     android:windowSoftInputMode="adjustPan" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

camera.class

 public void showNativeCamera(){ 

     // create Intent to take a picture and return control to the calling application 
     Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 


     UUID uniqueKey = UUID.randomUUID(); 
     mPictureName = "img_" + uniqueKey.toString() + ".jpg"; 
     fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image 
     Log.d("amanda", "file uri: " + fileUri); 
     intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name 


     intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 

     // start the image capture Intent 
     mParent.startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); 
    } 

的logcat:

10-23 13:42:45.250: V/CropImage(12042): Crop = no, Return = specified uri 
10-23 13:42:45.257: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=ActivityManager-Launch 
10-23 13:42:45.265: V/CropImage(12042): onPause 
10-23 13:42:45.273: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=SCREEN_FROZEN 
10-23 13:42:45.273: I/WindowManager(1528): Setting rotation to 1, animFlags=1 
10-23 13:42:45.289: I/ActivityManager(1528): Config changed 
10-23 13:42:45.375: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=SCREEN_FROZEN 
10-23 13:42:45.406: E/ClockWidget(11247): clock_bg portrait 
10-23 13:42:45.406: E/ClockWidget(11247): drawDayText 
10-23 13:42:45.406: E/ClockWidget(11247): width= 50 
10-23 13:42:45.406: E/ClockWidget(11247): widthText= 72.0 
10-23 13:42:45.406: E/ClockWidget(11247): RIGHT 
10-23 13:42:45.421: V/Camera(11982): --onActivityResult--requestCode: 2001 
10-23 13:42:45.421: V/Camera(11982): --onActivityResult--resultCode: -1 
10-23 13:42:45.421: V/Camera(11982): --onActivityResult--data: Intent { act=inline-data (has extras) } 
10-23 13:42:45.453: V/CropImage(12042): onDestroy 
10-23 13:42:45.914: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=ActivityManager-Launch 
10-23 13:42:45.921: W/ActivityManager(1528): Duplicate finish request for 
10-23 13:42:45.929: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=SCREEN_FROZEN 
10-23 13:42:45.929: I/WindowManager(1528): Setting rotation to 0, animFlags=1 
10-23 13:42:45.937: I/ActivityManager(1528): Config changed 
10-23 13:42:46.023: E/ClockWidget(11247): clock_bg portrait 
10-23 13:42:46.023: E/ClockWidget(11247): drawDayText 
10-23 13:42:46.023: E/ClockWidget(11247): width= 50 
10-23 13:42:46.023: E/ClockWidget(11247): widthText= 72.0 
10-23 13:42:46.023: E/ClockWidget(11247): RIGHT 
10-23 13:42:46.054: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=SCREEN_FROZEN 
10-23 13:42:46.210: I/ApplicationPackageManager(12075): cscCountry is not German : ANC 
10-23 13:42:46.218: D/amanda(12075): onCreate() called 
10-23 13:42:46.281: I/webclipboard(12075): clipservice: [email protected] 
10-23 13:42:46.398: V/geo aca(12075): pklsajdf 
10-23 13:42:46.398: V/geo aca(12075): [email protected] 
10-23 13:42:46.406: V/acastart(12075): lpm 
10-23 13:42:46.414: V/asd(12075): [network, passive, gps] 
10-23 13:42:46.421: D/androidNlpServiceThread(8458): adding listener com.[email protected]405a5b48 with period 45 
10-23 13:42:46.421: D/androidNetworkLocationListeners(8458): Still have listener com.[email protected]405a5b48 
10-23 13:42:46.421: D/WifiService(1528): [mPersistState] : On 
10-23 13:42:46.421: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=NetworkLocationLocator 
10-23 13:42:46.421: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=WifiService 
10-23 13:42:46.421: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=WifiService 
10-23 13:42:46.437: D/androidNlpServiceThread(8458): adding listener com.[email protected]405a5b48 with period 45 
10-23 13:42:46.437: D/androidNetworkLocationListeners(8458): Still have listener com.[email protected]405a5b48 
10-23 13:42:46.437: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=RILJ 
10-23 13:42:46.445: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=RILJ 
10-23 13:42:46.453: E/wpa_supplicant(4553): Ongoing Scan action... 
10-23 13:42:46.460: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=RILJ 
10-23 13:42:46.468: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=RILJ 
10-23 13:42:46.476: D/amanda(12075): onActivityResult() called 
10-23 13:42:46.484: D/amanda(12075): onActivityResult error: null 

回答