Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android actionBar not Showing main icon when installed on device

$
0
0

Hi I'm creating my first phone app for my first uni assignment, and I'm trying to create a simple action bar menu. My problem is i want the menu icon to awlays show and have the items under it. but when i install it on a android phone "Gallaxy" the menu item diappears but it shows in the emulator. here is my code This particular code is called from my controller file.

//Listen for the home window to open
streetAlertzHomeWindow.addEventListener("open", function() {
    if (Ti.Platform.osname === "android") {
        if (! streetAlertzHomeWindow.activity) {
            Ti.API.error("Can't access action bar on a lightweight window.");
        } else {
            actionBar = streetAlertzHomeWindow.activity.actionBar;
            if (actionBar) {
 
                actionBar.title = "Street Alertz";
                actionBar.icon = "images/appicon.png";
                actionBar.setDisplayShowHomeEnabled(true);
                actionBar.setDisplayShowTitleEnabled(true);
 
 
            }
        }
    }
});
//Create action bar when the window opens
streetAlertzHomeWindow.activity.onCreateOptionsMenu = function(e) { 
    var menu = e.menu;
    var menuItem = menu.add({ 
        title : "Settings", 
        icon : "images/ic_action_settings.png", 
        showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS
    }); 
    menuItem.addEventListener("click", function(e) { 
        alert('Menu item was clicked was clicked!');
    }); 
    var menuItem1 = menu.add({ 
        title : "Add Contacts", 
        icon : "images/ic_action_settings.png", 
        showAsAction : Ti.Android.SHOW_AS_ACTION_NEVER
    }); 
    menuItem1.addEventListener("click", function(e) { 
        streetAlertzAddContactWindow.open();
    }); 
};
I'm really new so any help would be awesome

Viewing all articles
Browse latest Browse all 8068

Trending Articles