Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Last active December 30, 2015 21:39
Show Gist options
  • Select an option

  • Save MotiurRahman/7888479 to your computer and use it in GitHub Desktop.

Select an option

Save MotiurRahman/7888479 to your computer and use it in GitHub Desktop.
ActionBar.setActionView() not executed in the UI Thread
/* Hi I have tested this jira ticket. It's not a bug. SetActionView() method execute here successfully just follow
steps to reproduce.
Testing Environment:
Titanium SDK: 3.1.3
Android SDK: 4.2.2
Steps to Reproduce:
1. Create a sample Project.
2. Paste this code in app.js file.
3. Paste this XML file in tiapp.xml.
4. And run this project with testing environment.
*/
var win = Ti.UI.createWindow({
navBarHidden : false,
title : 'Action Bar',
backgroundColor : '#000'
});
// var activity = win.activity;
win.activity.onCreateOptionsMenu = function(e) {
var menu = e.menu;
var refresh = menu.add({
title : 'Refresh',
showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS
});
refresh.addEventListener('click', function() {
var activityIndicator = Ti.UI.createActivityIndicator({
color : 'white',
font : {
fontSize : 26,
fontWeight : 'bold'
},
style : Ti.UI.ActivityIndicatorStyle.DARK,
});
this.setActionView(activityIndicator);
});
};
win.open();
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>16</tool-api-level>
<manifest>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
</manifest>
</android>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment