Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9983] Android: Map View annotations can't see their image in density subdirectories

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-02-10T17:26:28.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 3.1.0, 2013 Sprint 06 API, 2013 Sprint 06, Release 3.2.0
ComponentsAndroid
LabelsSupportTeam, community, core, exalture, mapv2, qe-testadded, titanbeta, triage
ReporterShawn Lipscomb
AssigneePing Wang
Created2012-07-06T11:45:23.000+0000
Updated2015-08-27T16:41:46.000+0000

Description

Problem

The annotations in a Map View can't find their *image* unless it is directly in the \Resources\android\images\ subdirectory. When multiple versions (sizes) of an image file are correctly placed in the density-specific subdirectories (\Resources\android\images\medium\, \Resources\android\images\high\, etc.), they cannot be found (aren't used), even after cleaning and rebuilding the project.

Expected behavior

The pin should show on the map.

Actual behavior

No pin shows on the map.

Testcase

Use the attached test project, which contains the entire project directory structure. The app.js contents are also shown here for completeness: {panel:title=app.js}
var win1 = Ti.UI.createWindow({
  backgroundColor:'#fff',
  exitOnClose:true,
  navBarHidden:true,
  layout:'vertical'
});

var map1=Ti.Map.createView({
              mapType:Ti.Map.STANDARD_TYPE,
              animate:true,
              region:{latitude:37.423156, longitude:-122.084917,
                      latitudeDelta:0.01, longitudeDelta:0.01},
              regionFit:true,
              annotations:[Ti.Map.createAnnotation({
                             latitude:37.423156,
                             longitude:-122.084917,
                             image:'/images/MapPin.png'
                           })],
              userLocation:true,
              height:Ti.UI.Fill
            });
win1.add(map1);

var square1=Ti.UI.createView({
              height:20,
              width:20,
              backgroundColor:'red',
              bottom:10,
              left:10
            });
map1.add(square1);

win1.open();
{panel}

Attachments

FileDateSize
MapViewSizeTest.zip2012-07-06T11:45:23.000+000031350

Comments

  1. jordi domenech 2012-11-13

    if somebody needs to make this work, it's very easy to resolve: https://github.com/iamyellow/titanium_mobile/commit/40040a0d981dfe196a9594a12612ba7d15bd9700
  2. Sunila 2013-03-08

    https://github.com/appcelerator/titanium_mobile/pull/3943
  3. Sunila 2013-03-16

    Modified code to incorporate review comments
  4. Ping Wang 2013-03-18

    Fix for Maps V2 module: https://github.com/appcelerator/titanium_modules/pull/92
  5. Anshu Mittal 2013-03-22

    Tested with: SDK: 3.1.0.v20130316201654 Studio:3.1.0.201303091040 Device: Samgung galaxy note(v 2.3.6)
  6. Ingo Muschenetz 2013-10-01

    Reopening based on comments.
  7. Ping Wang 2014-01-21

    Tested with SDK 3.2.0.GA and map module 2.1.2. The annotation image shows fine in density-specific directories (/Resources/android/images/high/applogo.png).
       var Map = require('ti.map');
       
       var win = Ti.UI.createWindow();
       
       var anno = Map.createAnnotation({
       	latitude : -33.87365,
       	image : 'images/applogo.png',
       	longitude : 151.20689,
       	title : "Sydney",
       	subtitle : "Sydney is quite chill",
       	draggable : true
       });
       
       var map = Map.createView({
       	userLocation : true,
       	mapType : Map.NORMAL_TYPE,
       	animate : true,
       	annotations : [anno],
       	region : {
       		latitude : -33.87365,
       		longitude : 151.20689,
       		latitudeDelta : 0.1,
       		longitudeDelta : 0.1
       	}, //Sydney
       	top : '50%'
       });
       Ti.API.info("userLocation: " + map.userLocation);
       win.add(map);
       
       map.addEventListener('click', function(e) {
       	Ti.API.info("Latitude: " + e.latitude);
       	Ti.API.info("Source: " + e.clicksource);
       });
       
       win.open();
       
  8. Ingo Muschenetz 2014-02-10

    Re-marking this as fixed based on [~pwang]'s comments. Please reopen if still an issue.
  9. Deepti Pandey 2014-04-17

    Closing the issue as working as expected. Map View annotations is visible if their image is in density subdirectories Test Environment: Appc-Studio:3.2.3.201404151910 sdk:3.2.3.v20140416151718 acs:1.0.14 alloy:1.3.1 npm:1.3.2 titanium:3.2.3-beta titanium-code-processor:1.1.1-beta1 xCODE:5.1.1 Device:Nexus7(v4.4.2)
  10. Cesar Cavazos 2015-08-27

    This is still happening in my current current environment. Appc-Studio: 4.2.0.201508062204 SDK: 4.1.0.GA alloy: 1.7.5 npm: 1.4.9 Emulator: Genymotion Android 4.2.2 720X1280 320 dpi Device: Nexus 4 Android 5.1.1 1280x768 320 dpi

JSON Source