Monday, April 8, 2013

[android help] App force closing when turning screen off


I can't figure out why my app is forceclosing when i turn off the screen, this is the logcat My app has scrolling text, displays widgets, gets user location, has a pager, gets the current time, gets the battery level, so the code is pretty long so for now i'll post only the logcat, maybe you can figure something out just with that If you need some pieces of code let me know



04-09 02:57:56.498: D/Evolution Launcher(16574): Stopping
04-09 02:57:56.623: W/IInputConnectionWrapper(16574): getExtractedText on inactive InputConnection
04-09 02:57:56.639: W/IInputConnectionWrapper(16574): getTextBeforeCursor on inactive InputConnection
04-09 02:57:56.655: W/IInputConnectionWrapper(16574): getSelectedText on inactive InputConnection
04-09 02:57:56.662: W/IInputConnectionWrapper(16574): getTextAfterCursor on inactive InputConnection
04-09 02:57:56.670: W/IInputConnectionWrapper(16574): getExtractedText on inactive InputConnection
04-09 02:57:56.670: W/IInputConnectionWrapper(16574): getTextBeforeCursor on inactive InputConnection
04-09 02:57:56.850: D/dalvikvm(16574): GC_EXPLICIT freed 1120K, 6% free 20548K/21696K, paused 3ms+13ms, total 140ms
04-09 02:57:56.959: W/IInputConnectionWrapper(16574): getExtractedText on inactive InputConnection
04-09 02:57:57.053: W/ResourceType(16574): Failure getting entry for 0x7f030004 (t=2 e=4) in package 0 (error -75)
04-09 02:57:57.053: D/AndroidRuntime(16574): Shutting down VM
04-09 02:57:57.053: W/dalvikvm(16574): threadid=1: thread exiting with uncaught exception (group=0x41356930)
04-09 02:57:57.069: E/AndroidRuntime(16574): FATAL EXCEPTION: main
04-09 02:57:57.069: E/AndroidRuntime(16574): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.doublep.evolution/com.doublep.evolution.LauncherActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030004
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3692)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.ActivityThread.access$700(ActivityThread.java:141)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1240)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.os.Looper.loop(Looper.java:137)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-09 02:57:57.069: E/AndroidRuntime(16574): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 02:57:57.069: E/AndroidRuntime(16574): at java.lang.reflect.Method.invoke(Method.java:511)
04-09 02:57:57.069: E/AndroidRuntime(16574): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-09 02:57:57.069: E/AndroidRuntime(16574): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-09 02:57:57.069: E/AndroidRuntime(16574): at dalvik.system.NativeStart.main(Native Method)
04-09 02:57:57.069: E/AndroidRuntime(16574): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030004
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.content.res.Resources.getValue(Resources.java:1014)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2139)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.content.res.Resources.getLayout(Resources.java:853)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-09 02:57:57.069: E/AndroidRuntime(16574): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.Activity.setContentView(Activity.java:1881)
04-09 02:57:57.069: E/AndroidRuntime(16574): at com.doublep.evolution.LauncherActivity.onCreate(LauncherActivity.java:455)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.Activity.performCreate(Activity.java:5104)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-09 02:57:57.069: E/AndroidRuntime(16574): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
04-09 02:57:57.069: E/AndroidRuntime(16574): ... 12 more
04-09 02:57:57.116: I/Process(16574): Sending signal. PID: 16574 SIG: 9


I've changed the setContentView to a different layout (different file, copied content from the old one) and it gives me a different forceclosing



04-09 03:34:25.514: D/dalvikvm(18864): GC_EXPLICIT freed 1259K, 6% free 20440K/21728K, paused 2ms+7ms, total 36ms
04-09 03:34:28.553: D/Evolution Launcher(18864): Stopping
04-09 03:34:28.756: W/IInputConnectionWrapper(18864): getExtractedText on inactive InputConnection
04-09 03:34:28.772: W/IInputConnectionWrapper(18864): getTextBeforeCursor on inactive InputConnection
04-09 03:34:28.780: W/IInputConnectionWrapper(18864): getSelectedText on inactive InputConnection
04-09 03:34:28.780: W/IInputConnectionWrapper(18864): getTextAfterCursor on inactive InputConnection
04-09 03:34:28.780: W/IInputConnectionWrapper(18864): getExtractedText on inactive InputConnection
04-09 03:34:28.787: W/IInputConnectionWrapper(18864): getTextBeforeCursor on inactive InputConnection
04-09 03:34:28.795: W/IInputConnectionWrapper(18864): getExtractedText on inactive InputConnection
04-09 03:34:28.795: W/IInputConnectionWrapper(18864): getTextBeforeCursor on inactive InputConnection
04-09 03:34:28.803: W/IInputConnectionWrapper(18864): getSelectedText on inactive InputConnection
04-09 03:34:28.803: W/IInputConnectionWrapper(18864): getTextAfterCursor on inactive InputConnection
04-09 03:34:28.811: W/IInputConnectionWrapper(18864): getExtractedText on inactive InputConnection
04-09 03:34:28.819: W/IInputConnectionWrapper(18864): getTextBeforeCursor on inactive InputConnection
04-09 03:34:28.819: W/IInputConnectionWrapper(18864): getSelectedText on inactive InputConnection
04-09 03:34:28.826: W/IInputConnectionWrapper(18864): getTextAfterCursor on inactive InputConnection
04-09 03:34:28.834: W/IInputConnectionWrapper(18864): beginBatchEdit on inactive InputConnection
04-09 03:34:28.834: W/IInputConnectionWrapper(18864): endBatchEdit on inactive InputConnection
04-09 03:34:28.834: W/IInputConnectionWrapper(18864): getExtractedText on inactive InputConnection
04-09 03:34:28.834: W/IInputConnectionWrapper(18864): getTextBeforeCursor on inactive InputConnection
04-09 03:34:28.842: W/IInputConnectionWrapper(18864): getSelectedText on inactive InputConnection
04-09 03:34:28.842: W/IInputConnectionWrapper(18864): getTextAfterCursor on inactive InputConnection
04-09 03:34:28.858: W/IInputConnectionWrapper(18864): beginBatchEdit on inactive InputConnection
04-09 03:34:28.858: W/IInputConnectionWrapper(18864): endBatchEdit on inactive InputConnection
04-09 03:34:29.569: D/dalvikvm(18864): GC_FOR_ALLOC freed 1154K, 7% free 21232K/22604K, paused 51ms, total 66ms
04-09 03:34:29.819: D/dalvikvm(18864): GC_FOR_ALLOC freed 201K, 7% free 23846K/25416K, paused 25ms, total 25ms
04-09 03:34:30.170: D/dalvikvm(18864): GC_FOR_ALLOC freed 3K, 6% free 26556K/28128K, paused 21ms, total 24ms
04-09 03:34:30.420: D/Evolution Launcher(18864): Loading variables
04-09 03:34:30.420: D/Evolution Launcher(18864): Restoring prefs
04-09 03:34:30.420: D/Evolution Launcher(18864): Screen density actions
04-09 03:34:30.467: W/IInputConnectionWrapper(18864): getExtractedText on inactive InputConnection
04-09 03:34:30.475: I/Choreographer(18864): Skipped 71 frames! The application may be doing too much work on its main thread.
04-09 03:34:30.631: E/ActivityThread(18864): Activity com.doublep.evolution.LauncherActivity has leaked IntentReceiver com.doublep.evolution.LauncherActivity$4@42858a78 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-09 03:34:30.631: E/ActivityThread(18864): android.app.IntentReceiverLeaked: Activity com.doublep.evolution.LauncherActivity has leaked IntentReceiver com.doublep.evolution.LauncherActivity$4@42858a78 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-09 03:34:30.631: E/ActivityThread(18864): at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:795)
04-09 03:34:30.631: E/ActivityThread(18864): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:596)
04-09 03:34:30.631: E/ActivityThread(18864): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1316)
04-09 03:34:30.631: E/ActivityThread(18864): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1296)
04-09 03:34:30.631: E/ActivityThread(18864): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1290)
04-09 03:34:30.631: E/ActivityThread(18864): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:423)
04-09 03:34:30.631: E/ActivityThread(18864): at com.doublep.evolution.LauncherActivity.batteryLevel(LauncherActivity.java:144)
04-09 03:34:30.631: E/ActivityThread(18864): at com.doublep.evolution.LauncherActivity.access$0(LauncherActivity.java:116)
04-09 03:34:30.631: E/ActivityThread(18864): at com.doublep.evolution.LauncherActivity$1.run(LauncherActivity.java:985)
04-09 03:34:30.631: E/ActivityThread(18864): at android.os.Handler.handleCallback(Handler.java:725)
04-09 03:34:30.631: E/ActivityThread(18864): at android.os.Handler.dispatchMessage(Handler.java:92)
04-09 03:34:30.631: E/ActivityThread(18864): at android.os.Looper.loop(Looper.java:137)
04-09 03:34:30.631: E/ActivityThread(18864): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-09 03:34:30.631: E/ActivityThread(18864): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 03:34:30.631: E/ActivityThread(18864): at java.lang.reflect.Method.invoke(Method.java:511)
04-09 03:34:30.631: E/ActivityThread(18864): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-09 03:34:30.631: E/ActivityThread(18864): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-09 03:34:30.631: E/ActivityThread(18864): at dalvik.system.NativeStart.main(Native Method)
04-09 03:34:30.701: W/IInputConnectionWrapper(18864): getTextBeforeCursor on inactive InputConnection
04-09 03:34:30.701: D/AndroidRuntime(18864): Shutting down VM
04-09 03:34:30.701: W/dalvikvm(18864): threadid=1: thread exiting with uncaught exception (group=0x41356930)
04-09 03:34:30.709: E/AndroidRuntime(18864): FATAL EXCEPTION: main
04-09 03:34:30.709: E/AndroidRuntime(18864): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.BATTERY_CHANGED flg=0x60000010 (has extras) } in com.doublep.evolution.LauncherActivity$4@42858a78
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:768)
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.os.Handler.handleCallback(Handler.java:725)
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.os.Handler.dispatchMessage(Handler.java:92)
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.os.Looper.loop(Looper.java:137)
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-09 03:34:30.709: E/AndroidRuntime(18864): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 03:34:30.709: E/AndroidRuntime(18864): at java.lang.reflect.Method.invoke(Method.java:511)
04-09 03:34:30.709: E/AndroidRuntime(18864): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-09 03:34:30.709: E/AndroidRuntime(18864): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-09 03:34:30.709: E/AndroidRuntime(18864): at dalvik.system.NativeStart.main(Native Method)
04-09 03:34:30.709: E/AndroidRuntime(18864): Caused by: java.lang.IllegalArgumentException: Receiver not registered: com.doublep.evolution.LauncherActivity$4@42858a78
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:657)
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1339)
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:445)
04-09 03:34:30.709: E/AndroidRuntime(18864): at com.doublep.evolution.LauncherActivity$4.onReceive(LauncherActivity.java:121)
04-09 03:34:30.709: E/AndroidRuntime(18864): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:758)
04-09 03:34:30.709: E/AndroidRuntime(18864): ... 9 more
04-09 03:34:30.741: I/Process(18864): Sending signal. PID: 18864 SIG: 9


Where you see the log "Stopping" it's when i turn off the screen, where you see "loading variables" it's in the onCreate, so it mean this time it's restarting but crashes anyways


This is how my layout looks like



xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/img_bkg" >

android:id="@+id/central"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" >

android:id="@+id/custom1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true" >

android:id="@+id/btn_1_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" >

android:id="@+id/btn_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_1" />

android:id="@+id/img_icon1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img_1" />


android:id="@+id/btn_2_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btn_1_holder" >

android:id="@+id/btn_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_2" />

android:id="@+id/img_icon2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img_2" />



android:id="@+id/custom2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >

android:id="@+id/btn_3_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" >

android:id="@+id/btn_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_3" />

android:id="@+id/img_icon3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img_3" />


android:id="@+id/btn_4_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btn_3_holder" >

android:id="@+id/btn_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_4" />

android:id="@+id/img_icon4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img_4" />



android:id="@+id/central_console"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/img_back" >

android:id="@+id/buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="3dp" >

android:id="@+id/btn_call"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_tel" />

android:id="@+id/btn_voice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_toRightOf="@id/btn_call"
android:background="@drawable/img_transparent"
android:fitsSystemWindows="true"
android:src="@drawable/btn_voice" />

android:id="@+id/btn_navigation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn_call"
android:layout_margin="2dp"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_nav" />

android:id="@+id/btn_media"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn_voice"
android:layout_margin="2dp"
android:layout_toRightOf="@id/btn_navigation"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_media" />


android:id="@+id/outer_ring"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:clickable="true"
android:src="@drawable/img_outer_ring"
android:visibility="visible" />

android:id="@+id/arcViewContainer"
android:layout_width="457px"
android:layout_height="457px"
android:layout_centerInParent="true" >

android:id="@+id/arcView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />


android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img_central_ring" />

android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:focusable="false"
android:longClickable="true"
android:text="@+string/time"
android:textColor="#ffffff"
android:textSize="57dp"
android:visibility="visible" />

android:id="@+id/pager"
android:layout_width="180dp"
android:layout_height="180dp"
android:layout_centerInParent="true" >


android:id="@+id/notification_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img_battery_low"
android:visibility="gone" />

android:id="@+id/reflection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img_reflection" />



android:id="@+id/drop_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:src="@drawable/img_drop_left"
android:visibility="gone" />

android:id="@+id/drop_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@drawable/img_drop_right"
android:visibility="gone" />

android:id="@+id/btn_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@drawable/img_settings_icon" />

android:id="@+id/btn_trip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_trip" />

android:id="@+id/btn_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@drawable/img_transparent"
android:src="@drawable/btn_info" />

android:id="@+id/lcd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/central"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:layout_toLeftOf="@id/btn_info"
android:layout_toRightOf="@id/btn_trip"
android:background="@drawable/leds" >

android:id="@+id/lcd_screen"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/img_lcd2" >

android:id="@+id/txt_lcd_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:ellipsize="marquee"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="#f82424"
android:textSize="30dp" />






.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...