HELP! Activity destroy timeout after screen lock

sally3599

Member
Licensed User
Longtime User
Here is the code:

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   Dim camera1 As Camera
   Dim btnTakePicture As Button
   Dim Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
End Sub
Sub Camera1_Ready (Success As Boolean)
   If Success Then
      camera1.StartPreview
      btnTakePicture.Enabled = True
   Else
      ToastMessageShow("Cannot open camera.", True)
   End If
End Sub

Sub Activity_Resume
   btnTakePicture.Enabled = False
   camera1.Initialize(Panel1, "Camera1")
End Sub

Sub Activity_Pause (UserClosed As Boolean)
   camera1.Release
End Sub

Sub Camera1_PictureTaken (Data() As Byte)
   camera1.StartPreview
   Dim out As OutputStream
   out = File.OpenOutput(File.DirRootExternal, "kara.jpg", False)
   out.WriteBytes(Data, 0, Data.Length)
   out.Close
   ToastMessageShow("Image saved: " & File.Combine(File.DirRootExternal, "kara.jpg"), True)
   btnTakePicture.Enabled = True
End Sub

Sub btnTakePicture_Click
   btnTakePicture.Enabled = False
   camera1.TakePicture
End Sub

I just run this app and leave it alone, then it show a error message when unlock screen, here is the log:

B4X:
I/WindowManager( 123): Setting rotation to 1, animFlags=1
I/ActivityManager( 123): Config changed: { scale=1.0 imsi=466/1 loc=zh_TW touch=3 keys=1/1/2 nav=2/1 orien=2 layout=17 uiMode=17 seq=20}
I/UsageStats( 123): Unexpected resume of camera.upload while already resumed in camera.upload
I/B4A ( 2610): ** Activity (main) Pause, UserClosed = false **
E/QualcommCameraHardware( 76): disableMsgType,mMsgEnabled=1d,msgType=1c2
E/QualcommCameraHardware( 76): disableMsgType,mMsgEnabled=1d,msgType=1ff
E/com.hanvon.inputmethod.calla.view.CallaViewnfo( 198): Display:(width=320; height=240;orientation=1;button size=30
W/dalvikvm( 2610): threadid=1: thread exiting with uncaught exception (group=0x400287f0)
W/B4A ( 2610): java.lang.NullPointerException
W/B4A ( 2610): at android.view.SurfaceView.updateWindow(SurfaceView.java:547)
W/B4A ( 2610): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:339)
W/B4A ( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
W/B4A ( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
W/B4A ( 2610): at android.view.View.draw(View.java:6743)
W/B4A ( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
W/B4A ( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
W/B4A ( 2610): at android.view.View.draw(View.java:6743)
W/B4A ( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
W/B4A ( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
W/B4A ( 2610): at android.view.View.draw(View.java:6743)
W/B4A ( 2610): at android.widget.FrameLayout.draw(FrameLayout.java:352)
W/B4A ( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
W/B4A ( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
W/B4A ( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
W/B4A ( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
W/B4A ( 2610): at android.view.View.draw(View.java:6743)
W/B4A ( 2610): at android.widget.FrameLayout.draw(FrameLayout.java:352)
W/B4A ( 2610): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
W/B4A ( 2610): at android.view.ViewRoot.draw(ViewRoot.java:1407)
W/B4A ( 2610): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
W/B4A ( 2610): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
W/B4A ( 2610): at android.os.Handler.dispatchMessage(Handler.java:99)
W/B4A ( 2610): at android.os.Looper.loop(Looper.java:123)
W/B4A ( 2610): at android.app.ActivityThread.main(ActivityThread.java:4627)
W/B4A ( 2610): at java.lang.reflect.Method.invokeNative(Native Method)
W/B4A ( 2610): at java.lang.reflect.Method.invoke(Method.java:521)
W/B4A ( 2610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
W/B4A ( 2610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
W/B4A ( 2610): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2610): FATAL EXCEPTION: main
E/AndroidRuntime( 2610): java.lang.NullPointerException
E/AndroidRuntime( 2610): at android.view.SurfaceView.updateWindow(SurfaceView.java:547)
E/AndroidRuntime( 2610): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:339)
E/AndroidRuntime( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
E/AndroidRuntime( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
E/AndroidRuntime( 2610): at android.view.View.draw(View.java:6743)
E/AndroidRuntime( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
E/AndroidRuntime( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
E/AndroidRuntime( 2610): at android.view.View.draw(View.java:6743)
E/AndroidRuntime( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
E/AndroidRuntime( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
E/AndroidRuntime( 2610): at android.view.View.draw(View.java:6743)
E/AndroidRuntime( 2610): at android.widget.FrameLayout.draw(FrameLayout.java:352)
E/AndroidRuntime( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
E/AndroidRuntime( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
E/AndroidRuntime( 2610): at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
E/AndroidRuntime( 2610): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
E/AndroidRuntime( 2610): at android.view.View.draw(View.java:6743)
E/AndroidRuntime( 2610): at android.widget.FrameLayout.draw(FrameLayout.java:352)
E/AndroidRuntime( 2610): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
E/AndroidRuntime( 2610): at android.view.ViewRoot.draw(ViewRoot.java:1407)
E/AndroidRuntime( 2610): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
E/AndroidRuntime( 2610): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
E/AndroidRuntime( 2610): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2610): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2610): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 2610): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2610): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 2610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 2610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 2610): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 123): Force finishing activity camera.upload/.main
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd RSSI-APPROX len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd MyHa2 rssi -47 len = 15, 15
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LINKSPEED len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LinkSpeed 24 len = 12, 12
I/WindowManager( 123): Setting rotation to 0, animFlags=1
I/ActivityManager( 123): Config changed: { scale=1.0 imsi=466/1 loc=zh_TW touch=3 keys=1/1/2 nav=2/1 orien=1 layout=17 uiMode=17 seq=21}
W/ActivityManager( 123): Activity pause timeout for HistoryRecord{43d8ddc8 camera.upload/.main}
E/com.hanvon.inputmethod.calla.view.CallaViewnfo( 198): Display:(width=240; height=320;orientation=0;button size=30
W/KeyCharacterMap( 123): Can't open keycharmap file
W/KeyCharacterMap( 123): Error loading keycharmap file '/system/usr/keychars/touchscreen_key.kcm.bin'. hw.keyboards.65541.devname='touchscreen_key'
W/KeyCharacterMap( 123): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd RSSI-APPROX len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd MyHa2 rssi -49 len = 15, 15
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LINKSPEED len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LinkSpeed 24 len = 12, 12
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd RSSI-APPROX len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd MyHa2 rssi -46 len = 15, 15
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LINKSPEED len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LinkSpeed 24 len = 12, 12
I/ActivityManager( 123): Process camera.upload (pid 2610) has died.
I/WindowManager( 123): WIN DEATH: Window{43f88b60 camera.upload/camera.upload.main paused=false}
W/InputManagerService( 123): Got RemoteException sending setActive(false) notification to pid 2610 uid 10067
I/ActivityManager( 123): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.jtb.alogcat/.LogActivity bnds=[2,87][58,150] }
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd RSSI-APPROX len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd MyHa2 rssi -47 len = 15, 15
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LINKSPEED len = 4096
D/wpa_supplicant( 192): wpa_driver_priv_driver_cmd LinkSpeed 24 len = 12, 12
W/ActivityManager( 123): Activity destroy timeout for HistoryRecord{43d8ddc8 camera.upload/.main}

Any help will be appreciate it.
 

sally3599

Member
Licensed User
Longtime User
it still shows the error

Thanks Erel.

Do you mean:

B4X:
Sub Activity_Resume
   Dim camera1 As Camera
   camera1.Initialize(Panel1, "Camera1")
End Sub

But it still shows that error.

Does it has any way to disable screen lock when this app running?
 
Upvote 0

sally3599

Member
Licensed User
Longtime User
here is the zip

I found the screen of many Camera app never lock, is there any solution to force screen on when this app running ?

Any help will be appreciate it.
 

Attachments

  • CameraLite.zip
    18.9 KB · Views: 149
Upvote 0

sally3599

Member
Licensed User
Longtime User
Thanks Erel.

is there any solution to force screen on when the app running ?
Thanks
 
Last edited:
Upvote 0
Top