[TIMOB-3244] Android: tabbed applications fail (crash) in honeycomb
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-04T16:28:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.7.0, Sprint 2011-12 |
Components | Android |
Labels | android, defect, honeycomb, release-1.7.0, reported-1.6.0 |
Reporter | Bill Dawson |
Assignee | Bill Dawson |
Created | 2011-04-15T03:40:17.000+0000 |
Updated | 2011-05-04T16:28:46.000+0000 |
Description
app.js fail case:
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
title:'Tab 1',
window:win1
});
tabGroup.addTab(tab1);
tabGroup.open();
Fail trace:
E/AndroidRuntime( 420): FATAL EXCEPTION: main
E/AndroidRuntime( 420): android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime( 420): at android.content.res.Resources.getValue(Resources.java:1014)
E/AndroidRuntime( 420): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2039)
E/AndroidRuntime( 420): at android.content.res.Resources.getLayout(Resources.java:853)
E/AndroidRuntime( 420): at android.view.LayoutInflater.inflate(LayoutInflater.java:389)
E/AndroidRuntime( 420): at android.widget.TabHost$LabelIndicatorStrategy.createIndicatorView(TabHost.java:534)
E/AndroidRuntime( 420): at android.widget.TabHost.addTab(TabHost.java:226)
E/AndroidRuntime( 420): at ti.modules.titanium.ui.widget.TiUITabGroup.addTab(TiUITabGroup.java:91)
E/AndroidRuntime( 420): at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:183)
Here's some native code you can play with that mimics how we create tabs:
HelloTabWidget.java
ArtistsActivity.java
This native example creates the
TabHost
usingnew TabHost(...)
like we do in our TiUITabGroup.java. It works fine in api 10 and lower, but not in api 11 (Honeycomb). If you alter the native code above (HelloTabWidget.java) so thatHelloTabWidget
extendsTabActivity
instead ofActivityGroup
, then replaceTabHost tabHost = new TabHost(this);
withTabHost tabHost = getTabHost();
, it will work fine in Honeycomb.I don't think we'll be able to solve this until we can see Honeycomb source code and see how the updated
TabActivity
creates itsTabHost
so we can do something similar. Some resource is missing, apparently. Maybe we need to do a.setId(...)
on something.Adding release-1.7.0 tag. May need to port back to 1.6.1. If we do then we'll add that tag then.
https://github.com/appcelerator/titanium_mobile/commit/19728696a23a8f9d45e044ead3b39162c68706fb"> https://github.com/appcelerator/titanium_mobile/commit/19728696a23a...
(from [19728696a23a8f9d45e044ead3b39162c68706fb]) Change TiTabActivity to inherit from TabActivity so as to use TabHost in the manner expected by android (TabActivity.getTabHost() rather than new TabHost()). This enables our default apps (the two-tab app that gets created when you create a new titanium project) to run on Honeycomb. [#3244] https://github.com/appcelerator/titanium_mobile/commit/19728696a23a8f9d45e044ead3b39162c68706fb"> https://github.com/appcelerator/titanium_mobile/commit/19728696a23a...
Verified on Xoom.