[AC-2034] Android: actionBar.displayHomeAsUp randomly shows double actionBar
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2013-09-17T22:40:23.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | actionbar, android |
| Reporter | Fokke Zandbergen |
| Assignee | Shak Hossain |
| Created | 2013-08-21T14:48:43.000+0000 |
| Updated | 2016-03-08T07:40:59.000+0000 |
Description
The combination of using the Android Holo theme with a TabGroup and using
Ti.Android.ActionBar.displayHomeAsUp in a second Window opened in one of the Tabs randomly results in a double ActionBar like shown in the attached screenshot.
As the XML layout next to the screenshot shows there are actually 2 Windows present, each with its own ActionBar.
Removing lines 12-14 from the app.js code below and the problem is gone, showing the cause lies in the displayHomeAsUp logic.
Steps to reproduce
1. Generate a new empty project 2. Replace the<android> tag in tiapp.xml with:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<uses-sdk android:targetSdkVersion="11"/>
<application android:theme="@android:style/Theme.Holo.Light"/>
</manifest>
</android>
3. Replace the contents of app.js with:
var tabGroup = Ti.UI.createTabGroup({
backgroundColor: "white"
});
var win1 = Ti.UI.createWindow({
title: "Window 1",
backgroundColor: "green"
});
win1.addEventListener('click', function () {
var win2 = Ti.UI.createWindow({
backgroundColor: 'red'
});
win2.addEventListener('open', function () {
win2.activity.actionBar.setDisplayHomeAsUp(true);
});
tab1.open(win2);
});
var tab1 = Ti.UI.createTab({
window: win1,
title: "Tab 1"
});
tabGroup.addTab(tab1);
tabGroup.open();
4. Repeatedly tap the green window to open the red window and use the hardware back button to return. Every now and then you should see the described behavior.
Attachments
| File | Date | Size |
|---|---|---|
| Schermafbeelding 2013-08-21 om 15.55.53.png | 2013-08-21T14:48:43.000+0000 | 68065 |
I am getting this error randomly on my apps, it shows every other time or so, there is no telling when it will occur.
Is this now fixed with TIMOB-14914?
[~Fokke] Please reopen if this is still resolved even after we resolved the related bug.
Haven't seen it happening anymore, so thx.