Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2446] Android: Crash when adding backgroundGradient to a TabGroup Window

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2012-11-21T18:33:31.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterMichael McDonald
AssigneeShak Hossain
Created2012-11-08T02:30:24.000+0000
Updated2016-03-08T07:41:29.000+0000

Description

Problem

Scenario: TabGroup has a Window with a backgroundGradient defined. Problem: Crashes in Android Emulator. (Works fine in iPhone simulator.) This works fine in the iPhone simulator, and when creating a stand-alone Window (not part of a TabGroup), and when applying the backgroundGradient to a View.

Test case

var win = Ti.UI.createWindow({
	title:'Gradient',
	backgroundGradient: {
		type: 'linear',
		startPoint: { x: '0%', y: '0%' },
		endPoint: { x: '0%', y: '100%' },
		colors: [ { color: 'red', offset: 0.0}, { color: 'blue', offset: 1.0 } ]
    }
});

var theTab = Ti.UI.createTab({
	title: 'Gradient',
	window: win
});

var tabGroup = Ti.UI.createTabGroup();
tabGroup.addTab(theTab);
tabGroup.setActiveTab(0);
tabGroup.open();

Error Log

[WARN][TiTabActivity(  262)] (main) [386,386] Notifying TiTabGroup, activity is created
[WARN][TiDrawableReference(  262)] (main) [86,472] Could not open stream to get bitmap
[WARN][dalvikvm(  262)] threadid=1: thread exiting with uncaught exception (group=0x4001d800)
[ERROR][TiApplication(  262)] (main) [39,644] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobilebackboard.bbdemo/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException; Titanium 2.1.3,2012/10/02 16:16,15997d0
[ERROR][TiApplication(  262)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobilebackboard.bbdemo/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException
[ERROR][TiApplication(  262)] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
[ERROR][TiApplication(  262)] 	at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
[ERROR][TiApplication(  262)] 	at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
[ERROR][TiApplication(  262)] 	at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
[ERROR][TiApplication(  262)] 	at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651)
[ERROR][TiApplication(  262)] 	at android.widget.TabHost.setCurrentTab(TabHost.java:323)
[ERROR][TiApplication(  262)] 	at android.widget.TabHost.addTab(TabHost.java:213)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.widget.TiUITabGroup.addTab(TiUITabGroup.java:105)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:204)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.TabGroupProxy.handlePostOpen(TabGroupProxy.java:298)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.TabGroupProxy$MessageHandler.handleMessage(TabGroupProxy.java:406)
[ERROR][TiApplication(  262)] 	at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR][TiApplication(  262)] 	at android.os.Looper.loop(Looper.java:123)
[ERROR][TiApplication(  262)] 	at android.app.ActivityThread.main(ActivityThread.java:4627)
[ERROR][TiApplication(  262)] 	at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][TiApplication(  262)] 	at java.lang.reflect.Method.invoke(Method.java:521)
[ERROR][TiApplication(  262)] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
[ERROR][TiApplication(  262)] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
[ERROR][TiApplication(  262)] 	at dalvik.system.NativeStart.main(Native Method)
[ERROR][TiApplication(  262)] Caused by: java.lang.NullPointerException
[ERROR][TiApplication(  262)] 	at org.appcelerator.titanium.view.TiUIView.handleBackgroundImage(TiUIView.java:923)
[ERROR][TiApplication(  262)] 	at org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:659)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.TiUIActivityWindow.processProperties(TiUIActivityWindow.java:451)
[ERROR][TiApplication(  262)] 	at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:891)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.TiUIActivityWindow.<init>(TiUIActivityWindow.java:109)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.TiUIActivityWindow.<init>(TiUIActivityWindow.java:90)
[ERROR][TiApplication(  262)] 	at ti.modules.titanium.ui.ActivityWindowProxy$1.windowCreated(ActivityWindowProxy.java:131)
[ERROR][TiApplication(  262)] 	at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31)
[ERROR][TiApplication(  262)] 	at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:372)
[ERROR][TiApplication(  262)] 	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:445)
[ERROR][TiApplication(  262)] 	at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:22)
[ERROR][TiApplication(  262)] 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
[ERROR][TiApplication(  262)] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
[ERROR][TiApplication(  262)] 	... 18 more
[ERROR][AndroidRuntime(  262)] FATAL EXCEPTION: main
[ERROR][AndroidRuntime(  262)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobilebackboard.bbdemo/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException
[ERROR][AndroidRuntime(  262)] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
[ERROR][AndroidRuntime(  262)] 	at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
[ERROR][AndroidRuntime(  262)] 	at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
[ERROR][AndroidRuntime(  262)] 	at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
[ERROR][AndroidRuntime(  262)] 	at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651)
[ERROR][AndroidRuntime(  262)] 	at android.widget.TabHost.setCurrentTab(TabHost.java:323)
[ERROR][AndroidRuntime(  262)] 	at android.widget.TabHost.addTab(TabHost.java:213)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.widget.TiUITabGroup.addTab(TiUITabGroup.java:105)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:204)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.TabGroupProxy.handlePostOpen(TabGroupProxy.java:298)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.TabGroupProxy$MessageHandler.handleMessage(TabGroupProxy.java:406)
[ERROR][AndroidRuntime(  262)] 	at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR][AndroidRuntime(  262)] 	at android.os.Looper.loop(Looper.java:123)
[ERROR][AndroidRuntime(  262)] 	at android.app.ActivityThread.main(ActivityThread.java:4627)
[ERROR][AndroidRuntime(  262)] 	at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][AndroidRuntime(  262)] 	at java.lang.reflect.Method.invoke(Method.java:521)
[ERROR][AndroidRuntime(  262)] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
[ERROR][AndroidRuntime(  262)] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
[ERROR][AndroidRuntime(  262)] 	at dalvik.system.NativeStart.main(Native Method)
[ERROR][AndroidRuntime(  262)] Caused by: java.lang.NullPointerException
[ERROR][AndroidRuntime(  262)] 	at org.appcelerator.titanium.view.TiUIView.handleBackgroundImage(TiUIView.java:923)
[ERROR][AndroidRuntime(  262)] 	at org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:659)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.TiUIActivityWindow.processProperties(TiUIActivityWindow.java:451)
[ERROR][AndroidRuntime(  262)] 	at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:891)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.TiUIActivityWindow.<init>(TiUIActivityWindow.java:109)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.TiUIActivityWindow.<init>(TiUIActivityWindow.java:90)
[ERROR][AndroidRuntime(  262)] 	at ti.modules.titanium.ui.ActivityWindowProxy$1.windowCreated(ActivityWindowProxy.java:131)
[ERROR][AndroidRuntime(  262)] 	at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31)
[ERROR][AndroidRuntime(  262)] 	at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:372)
[ERROR][AndroidRuntime(  262)] 	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:445)
[ERROR][AndroidRuntime(  262)] 	at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:22)
[ERROR][AndroidRuntime(  262)] 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
[ERROR][AndroidRuntime(  262)] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
[ERROR][AndroidRuntime(  262)] 	... 18 more

Comments

  1. Eduardo Gomez 2012-11-08

  2. Daniel Sefton 2012-11-21

    Closing as duplicate of TIMOB-9819.

JSON Source