Question

I followed the guide here: http://developer.appcelerator.com/guides/en/app_structure.html

to use high & medium density images for android.

My file structure is:

/Resources
/Resources/android
/Resources/android/images
/Resources/android/images/high/ic_menu_add.png
/Resources/android/images/medium/ic_menu_add.png
/Resources/android/images/default.png
/Resources/user
/Resources/user/super.js
/Resources/app.js

the default.png loads as expected.

I added 6 buttons to my menu in super.js (to try and debug this):

var activity = Ti.Android.currentActivity;
activity.onCreateOptionsMenu = function(e) {
  var menu = e.menu;
  var menuItem1 = menu.add({ title: "1" });
  menuItem1.setIcon("/images/ic_menu_add.png");
  menuItem1.addEventListener("click", function(e) {
  });
  var menuItem2 = menu.add({ title: "2" });
  menuItem2.setIcon("../images/ic_menu_add.png");
  menuItem2.addEventListener("click", function(e) {
  });
  var menuItem3 = menu.add({ title: "3" });
  menuItem3.setIcon("../ic_menu_add.png");
  menuItem3.addEventListener("click", function(e) {
  });
  var menuItem4 = menu.add({ title: "4" });
  menuItem4.setIcon("/images/ic_menu_add.png");
  menuItem4.addEventListener("click", function(e) {
  });
  var menuItem5 = menu.add({ title: "5" });
  menuItem5.setIcon("/ic_menu_add.png");
  menuItem5.addEventListener("click", function(e) {
  });
  var menuItem6 = menu.add({ title: "6" });
  menuItem6.setIcon("ic_menu_add.png");
  menuItem6.addEventListener("click", function(e) {
  });
}

When I press the menu button:

12-15 14:23:59.091: INFO/TiFileHlpr(537): (main) [4617,7631] /images/ic_menu_add.png not found.
12-15 14:23:59.101: INFO/TiFileHlpr(537): (main) [4,7635] ../images/ic_menu_add.png not found.
12-15 14:23:59.121: INFO/TiFileHlpr(537): (main) [25,7660] ../ic_menu_add.png not found.
12-15 14:23:59.121: INFO/TiFileHlpr(537): (main) [3,7663] /images/ic_menu_add.png not found.
12-15 14:23:59.131: INFO/TiFileHlpr(537): (main) [5,7668] /ic_menu_add.png not found.
12-15 14:23:59.140: INFO/TiFileHlpr(537): (main) [5,7673] ic_menu_add.png not found.

The official guide says to use just 'ic_menu_add.png' which is case 6 and doesn't work.

The build directory looks like this:

/build/android/res/drawable-hdpi/ic_menu_add_ad7ef1aa68.png
/build/android/res/drawable-mdpi/ic_menu_add_ad7ef1aa68.png

My custom AndroidManifest.xml has this section in it:

<supports-screens 
   android:largeScreens="true"
   android:anyDensity="true"
   android:normalScreens="true"  android:smallScreens="true"/>

Anyone know the proper way to get multiple density images to work? [I'm using mobile sdk 1.5.x]

Was it helpful?

Solution

This is a known and logged issue. It is scheduled to be fixed in the 1.6

You can check out the log from their bug tracking system:

Medium Density Images Bug Logged - Appcelerator

So, no immediate relief for you but it's coming. This happens to be on occasion, I'm currently waiting for the UIscreen for iOS so I can support external displays / VGA dongle.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top