Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-896] Android: Map addAnnotation throws NPE

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:35.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M05
ComponentsAndroid
Labelsandroid, defect
ReporterDon Thorp
AssigneeDon Thorp
Created2011-04-15T02:38:44.000+0000
Updated2011-04-17T01:54:35.000+0000

Description

There are several places in ViewProxy.java (the map ViewProxy) that refer to the variable (field) named "view". That thing is never ever set anywhere. It's always null. The Atlanta KS test works because the annotations are passed at the time of createView and not added later.

Comments

  1. Joshua 2011-04-15

    Is there a work around for this? I have a map where users can filter the type of venue's they can see on the map, but that requires the map to remove current annotations and add new ones. This currently doesn't work on android.

  2. Bill Dawson 2011-04-15

    I'm "in the code" anyway looking at #2154, so I'll have a look at this today.

  3. Bill Dawson 2011-04-15

    Failcase app.js (don't worry about the UI, just run this as your app.js):

       var dawson = Titanium.Map.createAnnotation({
           latitude:48.199678,
           longitude:16.395807,
           title:"Dawsonhaus"
       });
       
       var regionDefault = {latitude:48.199678,longitude:16.4,animate:true,latitudeDelta:0.04, longitudeDelta:0.04};
       
       var mapview = Titanium.Map.createView({
           mapType: Titanium.Map.STANDARD_TYPE,
           region:regionDefault,
           regionFit:true,
           top: 50, left: 0, right: 0, bottom: 0,
           userLocation:true
       });
       
       mapview.addAnnotation(dawson);
       
  4. Bill Dawson 2011-04-15

    (from [7b2cd40ce89729fa4cd7bca5a3697ecd6d97e534]) [#896 status:fixed-in-qa] use peekView() and null checks to avoid NPEs when trying to set TiMapView properties or call methods https://github.com/appcelerator/titanium_mobile/commit/7b2cd40ce89729fa4cd7bca5a3697ecd6d97e534"> https://github.com/appcelerator/titanium_mobile/commit/7b2cd40ce897...

  5. Bill Dawson 2011-04-15

    Added #2546 for a bigger issue, namely that pre-view-creation anything done with .addAnnotation and .removeAnnotation (and maybe other stuff) is ignored.

  6. Thomas Huelbert 2011-04-15

    [INFO] Titanium SDK version: 1.5.0 (12/10/10 09:14 0c31e15) using provided sample. need to add it to bugtests

JSON Source