[TIMOB-19504] Android: org.appcelerator.titanium.TiActivity cannot be cast to android.support.v7.app.ActionBarActivity
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-09-14T17:05:49.000+0000 |
| Affected Version/s | Release 5.0.0 |
| Fix Version/s | Release 5.0.0 |
| Components | Android |
| Labels | android |
| Reporter | Ben Bahrenburg |
| Assignee | Ashraf Abu |
| Created | 2015-09-13T04:16:22.000+0000 |
| Updated | 2015-09-15T00:36:09.000+0000 |
Description
If you follow the actionbar example from the documentation http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.ActionBar you will get the following error.
Uncaught Error: org.appcelerator.titanium.TiActivity cannot be cast to android.support.v7.app.ActionBarActivity
Hi [~ben.bahrenburg@gmail.com] thanks for the report. Note I made minor updates to the ticket to better reflect the error, and please only set severity (i.e. blocker), not priority. [~hpham] [~cng] [~msamah], please review ASAP.
This was already reverted by PR https://github.com/appcelerator/titanium_mobile/pull/7149 Confirmed this with the current 5_0_X branch with the test code:-
[~ben.bahrenburg@gmail.com], Thanks for the report.var win = Ti.UI.createWindow({ title: "Old Title" }); 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.title = "New Title"; } } } }); win.open();[~msamah] thanks. Reminder to use "Fixed" and not "Done"
Verified the fix. The app with action bar builds & displays the action bar successfully with build 5.0.0.v20150914163105. Closing. Environment: Appc Studio : 4.3.0.201509140942 Ti SDK : 5.0.0.v20150914163105 Ti CLI : 5.0.3 Alloy : 1.7.7 MAC Yosemite : 10.10.4 Appc NPM : 4.2.0-8 Appc CLI : 5.0.0-51 Node: v0.10.37 Nexus 5 - Android 5.1.1