Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2034] Android: actionBar.displayHomeAsUp randomly shows double actionBar

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2013-09-17T22:40:23.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsactionbar, android
ReporterFokke Zandbergen
AssigneeShak Hossain
Created2013-08-21T14:48:43.000+0000
Updated2016-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

FileDateSize
Schermafbeelding 2013-08-21 om 15.55.53.png2013-08-21T14:48:43.000+000068065

Comments

  1. Mark Mokryn 2013-08-21

  2. Ketan Majmudar 2013-08-28

    I am getting this error randomly on my apps, it shows every other time or so, there is no telling when it will occur.
  3. Fokke Zandbergen 2013-08-28

    Is this now fixed with TIMOB-14914?
  4. Shak Hossain 2013-09-17

    [~Fokke] Please reopen if this is still resolved even after we resolved the related bug.
  5. Fokke Zandbergen 2013-09-18

    Haven't seen it happening anymore, so thx.

JSON Source