Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2627] Android: Menu icons don't fetch density images

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:38.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M01
ComponentsAndroid
Labelsandroid, defect, release-1.6.0
ReporterBill Dawson
AssigneeBill Dawson
Created2011-04-15T03:25:13.000+0000
Updated2011-04-17T01:59:38.000+0000

Description

To reproduce:

app.js

Titanium.UI.setBackgroundColor('#000');
Titanium.UI.createWindow({  
    title:'Test',
    backgroundColor:'#fff',
    fullscreen: true,
    exitOnClose: true,
    url: 'win.js'
}).open();

Then make this win.js:

var win = Ti.UI.currentWindow;
Ti.Android.currentActivity.onCreateOptionsMenu = function(e) {
    var m1 = e.menu.add({
        itemId : 1,
        groupId : 0,
        order : 0,
        title: 'I am first'
    });
    m1.setIcon("images/test.png");
    var m2 = e.menu.add({
        itemId : 2,
        groupId : 0,
        order : 1,
        title: 'I am second'
    });
    m2.setIcon("KS_nav_ui.png");
};

Then ...

  • Create Resources/android/images/medium
  • Copy KS_nav_ui.png to Resources/android/images/medium/test.png (but also keep KS_nav_ui.png in Resources)

Run the app. When the blank window comes up, press the emulator/phone menu button. You should see two menu items, both of which show icons on them. But only one of them ('I am second') will have the icon.

Comments

  1. Bill Dawson 2011-04-15

    (from [caaf86a895b9cb21256c36b1d6a6d965df233175]) [#2627 state:fixed-in-qa] When loadDrawable calls getResourceDrawable, make sure the path is a resolved url because that's what getResourceDrawable expects. Change KS android_menu_1 test so that the first menu item uses a resource drawable (to prove it works) https://github.com/appcelerator/titanium_mobile/commit/caaf86a895b9cb21256c36b1d6a6d965df233175"> https://github.com/appcelerator/titanium_mobile/commit/caaf86a895b9...

  2. Bill Dawson 2011-04-15

    To QA: you can test either with my app.js & win.js example in the description of this item, or take the latest source of KS and try the Base UI - Menus (android) first menu test and make sure the first item in the menu has an icon on it.

  3. Thomas Huelbert 2011-04-15

    Titanium SDK version: 1.6.0 (01/03/11 08:14 11dd2b6), droid 1 (2.2.1) and G1 (1.6) verified icon appeared in menu

JSON Source