[AC-1389] Actionbar is undefined on Android < 3.0
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2014-10-15T02:14:50.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | 3.3.0.GA, actionbar, android, appcompat |
| Reporter | Manuel Lehner |
| Assignee | Shuo Liang |
| Created | 2014-07-24T10:16:43.000+0000 |
| Updated | 2016-03-08T07:37:48.000+0000 |
Description
Titanium.Android.ActionBar is not defined on Android version 2.3.7 (API 10) and prior. Since Titanium 3.3.0 using AppCombat this should be possible as the ActionBar is available.
Steps to reproduce:
1. Create new default app 2. Copy below example code into app.js 3. Run on Android emulator / device with Android 2.3.7 (API 10)Expected result:
actionbar should return a valid reference
Actual result:
actionbar is undefined
var win = Ti.UI.createWindow();
win.addEventListener('open', doOpen);
function doOpen(){
var activity = win.activity;
var actionbar = activity.actionbar;
Ti.API.info(activity);
Ti.API.info(actionbar);
}
win.open();
Q&A: http://developer.appcelerator.com/question/176443/hide-actionbar-on-tisdk330-with-android-2x-devices
Hi, Can you try this sample code in your device, as it works in my android 2.3.6.
var win = Ti.UI.createWindow({ title: "Old Title", navBarHidden: false }); var actionBar; win.addEventListener("open", function() { if (Ti.Platform.osname === "android") { if (! win.activity) { Ti.API.error("Can't access action bar on a lightweight window."); } else { actionBar = win.activity.actionBar; if (actionBar) { actionBar.backgroundImage = "/bg.png"; actionBar.title = "New Title"; actionBar.onHomeIconItemSelected = function() { Ti.API.info("Home icon clicked!"); }; } } } }); win.open();