Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10105] Android: Custom transparent theme crashes on 2.3 and below

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionNot Our Bug
Resolution Date2012-08-08T21:14:13.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsapi
ReporterRick Blalock
AssigneeHieu Pham
Created2012-07-23T17:15:09.000+0000
Updated2012-08-08T21:14:13.000+0000

Description

The attached code uses a transparent theme. It crashes on 2.3 and below but works on 4.0+. Trace:
[ERROR][TiApplication( 373)] (KrollRuntimeThread) [3535,3535] APP PROXY: ti.modules.titanium.app.AppModule@405d5da0
[WARN][V8Object( 373)] Runtime disposed, cannot set property 'userAgent'
[DEBUG][dalvikvm( 373)] GREF has increased to 201
[DEBUG][TiAssetHelper( 373)] Fetching "app.js" with Fastdev...
[INFO][ActivityManager( 62)] Starting: Intent { cmp=com.appc.tests/org.appcelerator.titanium.TiActivity (has extras) } from pid 373
[DEBUG][AndroidRuntime( 373)] Shutting down VM
[WARN][dalvikvm( 373)] threadid=1: thread exiting with uncaught exception (group=0x40015560)
[ERROR][TiApplication( 373)] (main) [809,4344] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appc.tests/com.appc.tests.AndroidTestsActivity}: java.lang.NullPointerException; Titanium 2.1.0,2012/06/28 12:16,6e3cab6
[ERROR][TiApplication( 373)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appc.tests/com.appc.tests.AndroidTestsActivity}: java.lang.NullPointerException
[ERROR][TiApplication( 373)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
[ERROR][TiApplication( 373)] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
[ERROR][TiApplication( 373)] at android.app.ActivityThread.access$1500(ActivityThread.java:117)
[ERROR][TiApplication( 373)] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
[ERROR][TiApplication( 373)] at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR][TiApplication( 373)] at android.os.Looper.loop(Looper.java:123)
[ERROR][TiApplication( 373)] at android.app.ActivityThread.main(ActivityThread.java:3647)
[ERROR][TiApplication( 373)] at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][TiApplication( 373)] at java.lang.reflect.Method.invoke(Method.java:507)
[ERROR][TiApplication( 373)] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
[ERROR][TiApplication( 373)] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
[ERROR][TiApplication( 373)] at dalvik.system.NativeStart.main(Native Method)
[ERROR][TiApplication( 373)] Caused by: java.lang.NullPointerException
[ERROR][TiApplication( 373)] at com.android.internal.policy.impl.PhoneWindow.getCircularProgressBar(PhoneWindow.java:2460)
[ERROR][TiApplication( 373)] at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2215)
[ERROR][TiApplication( 373)] at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2261)
[ERROR][TiApplication( 373)] at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:222)
[ERROR][TiApplication( 373)] at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216)
[ERROR][TiApplication( 373)] at android.app.Activity.setContentView(Activity.java:1668)
[ERROR][TiApplication( 373)] at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:434)
[ERROR][TiApplication( 373)] at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:162)
[ERROR][TiApplication( 373)] at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:99)
[ERROR][TiApplication( 373)] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
[ERROR][TiApplication( 373)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
[ERROR][TiApplication( 373)] ... 11 more
[ERROR][AndroidRuntime( 373)] FATAL EXCEPTION: main
[ERROR][AndroidRuntime( 373)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appc.tests/com.appc.tests.AndroidTestsActivity}: java.lang.NullPointerException
[ERROR][AndroidRuntime( 373)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
[ERROR][AndroidRuntime( 373)] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
[ERROR][AndroidRuntime( 373)] at android.app.ActivityThread.access$1500(ActivityThread.java:117)
[ERROR][AndroidRuntime( 373)] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
[ERROR][AndroidRuntime( 373)] at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR][AndroidRuntime( 373)] at android.os.Looper.loop(Looper.java:123)
[ERROR][AndroidRuntime( 373)] at android.app.ActivityThread.main(ActivityThread.java:3647)
[ERROR][AndroidRuntime( 373)] at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][AndroidRuntime( 373)] at java.lang.reflect.Method.invoke(Method.java:507)
[ERROR][AndroidRuntime( 373)] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
[ERROR][AndroidRuntime( 373)] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
[ERROR][AndroidRuntime( 373)] at dalvik.system.NativeStart.main(Native Method)
[ERROR][AndroidRuntime( 373)] Caused by: java.lang.NullPointerException
[ERROR][AndroidRuntime( 373)] at com.android.internal.policy.impl.PhoneWindow.getCircularProgressBar(PhoneWindow.java:2460)
[ERROR][AndroidRuntime( 373)] at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2215)
[ERROR][AndroidRuntime( 373)] at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2261)
[ERROR][AndroidRuntime( 373)] at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:222)
[ERROR][AndroidRuntime( 373)] at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216)
[ERROR][AndroidRuntime( 373)] at android.app.Activity.setContentView(Activity.java:1668)
[ERROR][AndroidRuntime( 373)] at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:434)
[ERROR][AndroidRuntime( 373)] at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:162)
[ERROR][AndroidRuntime( 373)] at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:99)
[ERROR][AndroidRuntime( 373)] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
[ERROR][AndroidRuntime( 373)] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)

Attachments

FileDateSize
Archive.zip2012-07-23T17:15:09.000+0000750636

Comments

  1. Josh Roesslein 2012-08-02

    Rick, The last time we spoke I believe we found the cause of this bug. It is caused by some window features we request when creating the activity. If you create a window w/o a title bar you need to set the parameter "navBarHidden" to false. You will need to apply the custom theme only to the custom activity for this window. Otherwise every window will be affected including the launch activity (which is the one crashing here).
  2. Josh Roesslein 2012-08-02

    FYI: the crash is caused by requesting title bar features, but the theme causes no title bar to be created for the Window. This causes a crash due to 2.3 or earlier trying to setup titlebar features leading to a crash. This is an Android bug. As mentioned before you have to set "navBarHidden" on the window to prevent those features.
  3. Hieu Pham 2012-08-02

    Also, you shouldn't comment this out:
       <intent-filter>
       	<action android:name="android.intent.action.MAIN" />
       	<category android:name="android.intent.category.LAUNCHER" />
       </intent-filter> 
       
    You won't see the launcher if this isn't included in the main activity (in AndroidManifest.xml).
  4. Rick Blalock 2012-08-03

    Ok so navBarHidden will not crash it?
  5. Josh Roesslein 2012-08-08

    Rick, yes if you set navBarHidden to "true" it shouldn't crash.
  6. Josh Roesslein 2012-08-08

    Closing since no further platform changes are required.

JSON Source