Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Blank screen on android

Hi!

Anyone found a solution to the blank screen, when resuming an app on android, after having the screen turned off for a while?
We really don't want to have to rewrite our app in java for this extremely annoying bug. Impossible to try to fix with alternative methods, when it takes at least 15 minutes for the bug to appear.
app.js adds a tabgroup and has all the code for the first tab window in it. (Everything works great for iPhone)

David's code in:
http://developer.appcelerator.com/question/102921/blank-screen-on-resume
doesn't work for us either. The resume event is only fired when starting the app, never when returning after hitting the home button.
Is there any way to make the app exit when pressing home?

— asked April 6th 2011 by Mikael Jergefelt
  • android
  • blank
  • bug
  • screen
0 Comments

10 Answers

  • My code in the above link was a hack. See this jira issue for the explanation and this one for how to the fix it.

    In a nutshell you need to add android:alwaysRetainTaskState="true" to your root activity.

    — answered November 1st 2011 by David Bankier
    permalink
    1 Comment
    • Peak at the code in the KitchenSink tiapp.xml for the full block.

      — commented November 12th 2011 by Brandon Fuller
  • I am suffering the same problem and clearly this is preventing me from releasing any application on Android. Quite annoying!

    Any solution or workaround is more than welcomed.

    — answered October 22nd 2011 by Laurent Rodier
    permalink
    0 Comments
  • Having the same issue, and android:alwaysRetainTaskState="true" does nothing :(

    — answered December 1st 2011 by C H
    permalink
    0 Comments
  • I've been having this problem too, it's taken me weeks to pinpoint it down to this. Hoping that the solution herein works, will post back to check.

    In the meantime, I've tried other things, and all I've found is that the app doesn't actually break until you try to restart it. Wondering if it's related to 'Layout Cleanup' from TiBaseActivity in the DDMS log.

    — answered December 9th 2011 by David Horton
    permalink
    0 Comments
  • same problem here, using sdk 1.8.0, android 4.0/4.03

    any solution yet?

    — answered January 8th 2012 by Arjan Brinkman
    permalink
    0 Comments
  • Look in kitchen sink manifest XML file, match it and you'll be good to go.

    — answered January 9th 2012 by David Horton
    permalink
    8 Comments
    • I've been using this for some days now, but it doesn't solve the problem. Running 3 apps that I am building on, all 3 have the problem.

          <android xmlns:android="http://schemas.android.com/apk/res/android">
              <tool-api-level>8</tool-api-level>
              <manifest android:installLocation="auto" android:versionCode="2" android:versionName="1.1">
                  <uses-sdk android:minSdkVersion="7" />
                  <supports-screens android:anyDensity="true"
                      android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
                  <application>
                      <activity android:alwaysRetainTaskState="true"
                          android:configChanges="keyboardHidden|orientation"
                          android:label="Applabel"
                          android:name=".ApplabelActivity" android:theme="@style/Theme.Titanium">
                          <intent-filter>
                              <action android:name="android.intent.action.MAIN"/>
                              <category android:name="android.intent.category.LAUNCHER"/>
                          </intent-filter>
                      </activity>
                  </application>
              </manifest>
          </android>
      

      — commented January 9th 2012 by Arjan Brinkman
    • important notice:

      when I wait for the app to come up with an error I get the following message:

      Activity "name of app" is not responding. After that I can close or wait.

      Android report:

      ANR keyDispatchingTimedOut in TiTabActivity
      Freeze
      Activitty fail.android.app/ti.modules.titanium.ui.TiTabActivity
      Cause ANR keyDispatchingTimedOut
      

      Link to stacktrace output: http://pastebin.com/mBPCNuTC

      — commented January 9th 2012 by Arjan Brinkman
    • Didn't work for me either. REALLY frustrating to have to hold off launching our apps because of this. This is the type of issue I was afraid of when choosing to go with a non-native development platform.

      — commented January 30th 2012 by Jake Horner
    • Is there a workarround?

      — commented January 31st 2012 by Sander Beck
    • Mine works fine with the manifest above. The problem lies elsewhere, like in the way your window is set up. I'd take a different approach, and look carefully in the device logcat for other problems. Try the easy stuff, clearing out build folder etc.

      — commented January 31st 2012 by David Horton
    • The problem does not lie elsewhere. The default Hello World app displays this issue with and without the manifest entries added. It is a systemic problem and not one caused by any coding approach. The manifest entries do nothing to help this issue. Verified on Droid, DroidX and Xoom.

      — commented February 3rd 2012 by Tom Hill
    • I'm at a loss for you guys then. Maybe it's a Ti SDK version issue, I'm on 1.7.5? My app hit the market with no issues after I used the manifest thing. Maybe try a fresh project in the SDK version you want to use…

      — commented February 3rd 2012 by David Horton
    • We're on SDK 1.8.1 and we're still having the blank-screen problem after making the Android Manifest mods. As I think everyone will agree, this seems like a pretty bad regression.

      — commented February 8th 2012 by Joe Falcone
  • any news? Status on bugreport says it's resolved: https://jira.appcelerator.org/browse/TIMOB-7293

    — answered February 20th 2012 by Arjan Brinkman
    permalink
    0 Comments
  • OK. So it looks like the bug returned with vengeance in 1.8.x, but is now fix again with the above changes to the manifest/tiapp.xml.

    Go to the following link and download the latest build from the master branch (in the drop-down at the top).

    — answered February 21st 2012 by David Bankier
    permalink
    2 Comments
    • Using build mobilesdk-2.0.0.v20120222101634 with the above additions to TiApp.xml I am still having the same problem. The app just stays at the splash screen

      — commented February 22nd 2012 by Frodeaux *
    • I am experiencing the same splash screen problem. Chris: did you find a way to solve it?

      — commented March 6th 2012 by Nahum Romero
  • After adding <property name="ti.android.root.reappears.restart" type="bool">true</property> to tiapp.xml the app seems to restart normally

    — answered June 12th 2012 by Eduardo Gomez
    permalink
    0 Comments
  • I'm on 3.1.3 GA (XPeria Arc S) and this issue still persist. I've tried all the solutions above but nothing helped. LogCat is reporting that custom modules are re-created ok, however the screen is blank (black). One message I noticed in the LogCat was:

    W/PhoneWindow(7206): Previously focused view reported id 235 during save, but can't be found during restore.
    

    This would indicate something wrong when restoring the window from a persistent state. Might be that if there's a complex window with many subviews, the Appcelerator platform has difficulties reconstructing it properly (or does it in wrong order).

    Well, 3 years and still no reasonable fix. Yet another reason to go native.

    — answered October 24th 2013 by Ondrej Urik
    permalink
    3 Comments
    • We have the same problem for our Android app.
      None of the solutions above helped me to solve it.

      … BUT …

      We recently observed that the KitchenSink app (from Appcelerator) is not affected (using the exact same Titanium SDK, Android SDK, …).
      Looking deeper in our code, we eventually found that one of our included module was the origin of the issue. If we remove this module from the tiapp.xml, the issue disappears.

      You should check your modules if you have ones!
      Remove all of them and try to reproduce

      The UrbanAirship module generate the issue on our app.

      It is really hard for me, right now, to understand why.
      I will check the diff in the AndroidManifest with and without the module.

      On app resume (+ white screen of death…), in the Android Monitor, there is some logs like "ignoring postAnalyticsEvent" that make me curious:

      11-21 09:25:04.369: D/TiBaseActivity(13388): (main) [26180,29805] Activity org.appcelerator.titanium.TiActivity@42daefa8 onPause
      11-21 09:25:04.389: I/TiApplication(13388): (main) [19,29824] Analytics are disabled, ignoring postAnalyticsEvent
      11-21 09:25:38.402: I/Dev 0.0.0 - UALib(13388): Sending 1 events.
      11-21 09:25:38.422: I/Dev 0.0.0 - UALib(13388): Sending Analytics to: https://combine.urbanairship.com/warp9/
      11-21 09:25:38.972: I/Dev 0.0.0 - UALib(13388): Warp 9 response: 200
      

      — commented November 21st 2013 by Arnaud Besnier
    • Our issue with the UrbanAirship module is not solved.
      So any help is really welcome!

      — commented November 21st 2013 by Arnaud Besnier
    • Hi Arnaud,

      Can you share tiapp.xml ? To have a look at the Android manifest section specifically. I'd be happy to to provide recommendations. Does the problem occur at any Android OS on particular? Any TiSDK you can state?

      Thanks.

      — commented November 21st 2013 by Eduardo Gomez
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.