<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>16</tool-api-level>
<manifest android:installLocation="preferExternal">
<supports-screens android:anyDensity="false"/>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14"/>
</manifest>
</android>
App crashes when setting a remote URL for the ActionBar logo, backgroundImage, or icon. See code below.
index.xml:
<Alloy>
<Window id="myWin" class="container" navBarHidden="false">
</Window>
</Alloy>
index.js:
$.myWin.addEventListener('open', function() {
if (Ti.Platform.name === 'android') {
var act = $.myWin.activity;
if (!act) {
alert("Can't access action bar on a lightweight window.");
} else {
var actionBar = act.actionBar;
if (actionBar){
//These work fine, it's the same image as in URL
//actionBar.setLogo('/images/smallpic.jpg');
//actionBar.setIcon('/images/smallpic.jpg');
//actionBar.setBackgroundImage('/images/smallpic.jpg');
//Any of the below crash the app
actionBar.setLogo('https://graph.facebook.com/shaverm/picture');
//actionBar.setBackgroundImage('https://graph.facebook.com/shaverm/picture');
//actionBar.setIcon('https://graph.facebook.com/shaverm/picture');
}
}
}
});
$.myWin.open();
Copy and pasted code into respective folders. Do not see an actionbar or evidence of crashing. Using Galaxy s3 4.1.2. Can you please provide a more thorough set of steps to reproduce and any other information that may be missing? For reference: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report Thanks, Carter
Can you paste your tiapp.xml here? It should contain the XML I showed above. On ICS, unless you're explicitly hiding the action bar (e.g. navBarHidden = true) it should appear. So I would assume the issue is with your tiapp.xml or your tool setup. I tested with API 16 tools, as shown by the XML.
Carter, this likely better assigned to the platform team as it appears it is not directly related to Alloy.
Mark, are you testing this on ICS or on Jellybean? Here is my xml
let me know if I have everything you do. Carter
Hi Carter, My environment is as specified above - 3.0.2, Nexus S, Android 4.1.2 I took your XML verbatim (except my Studio complained about the tizen line), I pasted the code from above into index.xml and index.js. It crashes with setLogo (and the other functions too) for URL images, fine with file images (same image in all cases). It's a network request on main thread, here's the crash log:
Mark, Would you mind providing a couple screenshots. One of the working actionbar and one of the crashing instance? Then I will move to Ti-Mobile. Thanks for your patience, Carter
Screen shots attached. Again - the only difference is
(fine) versus
(crash). The image is the same. Tiapp.xml is the copy you sent, verbatim except Tizen line.
Is it possible to try this again on 3.1.0? I'm assuming no difference, but it would be helpful to confirm.
Mark, After talking this over with engineering, I realized that it is not recommended to use a remote image location for a logo or icon within an action bar. It is only really acceptable to use a remote image when loading it into a imageview first. In order to achieve the same effect as an actionbar you can put this imageview into a custom view that acts and looks like an actionbar. Any questions or comments feel free to ask. Regards, Carter
I agree with this, but please update the docs to remove the URL option for Action Bar icon, logo, backgroundImage. And yes, it crashes with 3.1.0 beta release.