×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    The relevant class diagram can be found below.


    If your mnRute class extends MapCanvas, you don't need to instantiate your own instance of

    Code:
    MapCanvas mapCanvas;
    MapDisplay mapDisplay;
    The subclass can access those already found in the MapCanvas class.
    • All instances of mapCanvas.addCommand() can be replaced with addCommand() and so on.
    • All instances of mapDisplay.addMapObject() can be replaced with getDisplay().addMapObject() and so on.



    I suspect the code as currently written is displaying the MapDisplay contained in the base class whereas you are attaching objects to your own private instance of MapDisplay which is not current

    For a fully working 1.0 example check out the code commentary at:
    http://www.developer.nokia.com/Devel...mples/#routing

    Or the article at:
    http://www.developer.nokia.com/Commu...PI_for_Java_ME

  2. #17
    Registered User
    Join Date
    May 2012
    Posts
    18

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by jasfox View Post

    If your mnRute class extends MapCanvas, you don't need to instantiate your own instance of

    Code:
    MapCanvas mapCanvas;
    MapDisplay mapDisplay;
    The subclass can access those already found in the MapCanvas class.
    • All instances of mapCanvas.addCommand() can be replaced with addCommand() and so on.
    • All instances of mapDisplay.addMapObject() can be replaced with getDisplay().addMapObject() and so on.



    I suspect the code as currently written is displaying the MapDisplay contained in the base class whereas you are attaching objects to your own private instance of MapDisplay which is not current
    Ok thanks sir, its working


    ====================================

    I want to display the navigation for a route.
    what nokia Map API support to navigate?
    if so, how to display navigation on a route that has been gained?

    thank you sir
    Last edited by Arif_Mubashir; 2012-05-31 at 07:04.

  3. #18
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by Arif_Mubashir View Post
    I want to display the navigation for a route.
    what nokia Map API support to navigate?
    if so, how to display navigation on a route that has been gained?
    You should look up the use of the Route and Maneuver classes in the JavaDoc available with the API download. You can get summary information from your Route and the starting Maneuver from route.getFirstManeuver(); , thereafter the Maneuvers can be read from a doubly linked list .

    The following articles should help:

  4. #19
    Registered User
    Join Date
    May 2012
    Posts
    18

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by jasfox View Post
    You should look up the use of the Route and Maneuver classes in the JavaDoc available with the API download. You can get summary information from your Route and the starting Maneuver from route.getFirstManeuver(); , thereafter the Maneuvers can be read from a doubly linked list .

    The following articles should help:
    I create setCurrentManeuver() method in my mnRute class
    Code:
    private synchronized void setCurrentManeuver(RouteManeuver maneuver) {
            if (currentMarker == null) {
                currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition());
                getMapDisplay().addMapObject(currentMarker);
            } else {
                currentMarker.setCoordinate(maneuver.getPosition());
            }
    
            currentManeuver = maneuver;
            getMapDisplay().setCenter(currentManeuver.getPosition());
        }
    But, error in:
    Code:
    currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition());
    error:
    Code:
    method createStandardMarker in class com.nokia.maps.map.MapFactory cannot be applied to given types
    required: com.nokia.maps.common.GeoCoordinate,int,java.lang.String,com.nokia.maps.map.MapShapeType
    found: com.nokia.maps.common.Geocoordinate
    thanks sir..

  5. #20
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    This is because the code in the article has been written to work with Nokia Maps for Java ME v1.0 , not the beta release you are currently using. You can tell this by looking at the Article Meta Data:

    Compatibility:
    Platform(s): Series 40
    Dependencies: Maps API for Java ME v1.0

    I would strongly urge you to update to the later version.

    In the 1.0 API, MapFactory.createStandardMarker(GeoCoordinate) is a convenience overload of createStandardMarker(GeoCoordinate , int , String , int ),


    If you must stick with the obsolete version of the API try adding in default values for the missing parameters, something like:

    Code:
    currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition() ,  -1, "", MapStandardMarker.BALLOON);

  6. #21
    Registered User
    Join Date
    May 2012
    Posts
    18

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by jasfox View Post

    If you must stick with the obsolete version of the API try adding in default values for the missing parameters, something like:

    Code:
    currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition() ,  -1, "", MapStandardMarker.BALLOON);
    Thank sir, its working

    I was able to navigate. but still I want to ask. during navigation. There are guidelines for the information to the destination point with Map Image. Could I just show the form of information without a Map?

    example:
    from A Street to D Street

    Form Navigational directions:
    Right A street. Go to 20m
    Left B Street. Go to 200m


    Thank you sir...

  7. #22
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by Arif_Mubashir View Post
    Thank sir, its working
    I was able to navigate. but still I want to ask. during navigation. There are guidelines for the information to the destination point with Map Image. Could I just show the form of information without a Map?
    The Code in the Wiki article is free for you to alter as you see fit. If you don't need/want to display the turnpoint images, then you don't have to. An added advantage of not displaying turnpoints is that you are saving on http requests and therefore reducing network traffic for your end user.

  8. #23
    Registered User
    Join Date
    May 2012
    Posts
    18

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by jasfox View Post
    The Code in the Wiki article is free for you to alter as you see fit. If you don't need/want to display the turnpoint images, then you don't have to. An added advantage of not displaying turnpoints is that you are saving on http requests and therefore reducing network traffic for your end user.
    ok thank you sir..

    ==============================================

    I use JSR-179 to display my current position..
    I have made that and run in my handphone..
    When I move, the marker (my positon marker) is not move..
    How to move my position marker when I move? (Real-time position)

    This is my code for display my current position
    Code:
    public mnPosisiku (mnUtm midlet, Display display) {
            this.midlet = midlet;
            this.display = display;
            wpl = new WaypointParameterList();
            skala = new skalaMap();
            kompas = new legendaMap();
        }
    
        public void pos() {
          try {
          //Make MapCanvas
            mapCanvas = new MapCanvas(display);
            mapDisplay = mapCanvas.getMapDisplay();
    
          //Make Command
            cmKembali = new Command("Kembali", Command.BACK, 0);
            cmInfo = new Command("Info", Command.OK, 1);
            mapCanvas.addCommand(cmKembali);
            mapCanvas.addCommand(cmInfo);
            mapCanvas.setCommandListener(this);
            
         //Current position with JSR-179
            Criteria cr = new Criteria();
            cr.setHorizontalAccuracy(500);
    
            lp = LocationProvider.getInstance(cr);
    
            Location l = lp.getLocation(60);
            Coordinates c = l.getQualifiedCoordinates();
    
                if (c != null) {
                        double lat = c.getLatitude();
                        double lon = c.getLongitude();
      
            mapCanvas.getMapDisplay().setCenter(new GeoCoordinate(lat, lon, 0));
            mapCanvas.getMapDisplay().setZoomLevel(16,0,0);
    
         //Make marker (my current position) in Map
           Point center = new Point(mapCanvas.getWidth()/2, mapCanvas.getHeight()/2);
           GeoCoordinate gc = mapDisplay.pixelToGeo(center);
           wpl.addCoordinate(gc);
           pos = mapCanvas.getMapFactory().createStandardMarker(gc, 10, null, MapShapeType.bed);
           mapDisplay.addMapObject(pos);
           mapDisplay.addMapComponent(skala);
           mapDisplay.addMapComponent(kompas);
           mapCanvas.setTitle("Posisi Saat Ini");
    
           string = "Posisi Anda Saat ini Berada di :" +
                            "\nLatitude : " + lat + "\nLongitude : " + lon;
    
         //Display Map
            display.setCurrent(mapCanvas);
        
                }
    
        } catch (Exception ex) {
            ex.printStackTrace();
            }
        }
    
        public void commandAction(Command c, Displayable d) {
          //Back to Main Menu
            if (c == cmKembali) {
               display.setCurrent(midlet.menu);
               }
               //Display Coordinates my position
                if (c == cmInfo) {
                    info = new Alert("Detail Posisi", string, null, AlertType.INFO);
                    info.setTimeout(60000);
                    display.setCurrent(info, mapCanvas);
                }
        }
    }

    Thanks Sir..
    Last edited by Arif_Mubashir; 2012-06-04 at 00:30.

  9. #24
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by Arif_Mubashir View Post
    I use JSR-179 to display my current position..
    I have made that and run in my handset..
    When I move, the marker (my position marker) is not move..
    There are various articles on the best practices for using JSR-179, I would suggest you look at the following:

    http://www.developer.nokia.com/Commu...on_API_JSR_179
    http://www.developer.nokia.com/Commu...ion_in_Java_ME
    http://www.developer.nokia.com/Commu...on_via_Cell_ID
    http://www.developer.nokia.com/Commu...cation_updates

    Basically there are two ways of achieving this - if your handset contains GPS you can set up a location listener which will periodically callback locationUpdated() when the location has changed. I believe your code is implementing Cell-ID based location however which cannot use this. You'll need to set up a loop to periodically call getLocation() instead.

    Quote Originally Posted by Arif_Mubashir View Post
    How to move my position marker when I move? (Real-time position)
    Once you have retrieved a location update, you can display the result on a map as shown in the following article: http://www.developer.nokia.com/Commu...esult_on_a_Map

    If you require further information about how set up the code to locate a device, I would suggest you ask a separate question on the LBS sub-forum:
    http://www.developer.nokia.com/Commu...and-Navigation rather than extending this thread on the maps sub-forum.

  10. #25
    Registered User
    Join Date
    May 2012
    Posts
    18

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by jasfox View Post
    An article on how to do this has now been submitted to the Community Wiki: http://www.developer.nokia.com/Commu...leBarComponent
    I set zoom level (17, 0, 0) in my aplication
    I run my application, on a map written 25 m
    what the meaning of 25 m in scale?
    1 cm in map = 25 m at the real condition?
    and when I zoom in, that still 25 m why the scale is not change?

    I want to set the zoom level is only reached level 17 so if it is at level 17 can not zoom in
    how to set the zooming level sir?

    thank you sir.

  11. #26
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by Arif_Mubashir View Post
    I set zoom level (17, 0, 0) in my aplication
    I run my application, on a map written 25 m
    what the meaning of 25 m in scale?
    1 cm in map = 25 m at the real condition?
    and when I zoom in, that still 25 m why the scale is not change?
    The scale is the distance of the black line below the text. Only zooms <18 are supported. To add more levels add entries to SCALE_IN_METRES, SCALE_IN_IMPERIAL and so on.

    Quote Originally Posted by Arif_Mubashir View Post
    I want to set the zoom level is only reached level 17 so if it is at level 17 can not zoom in
    .
    To restrict the zoom level add something like the following to any MapComponent:
    Code:
     public void mapUpdated(boolean zoomChanged) {
    
            if (zoomChanged && getMap().getZoomLevel() > 17){
                getMap().setZoomLevel(17, 0, 0);
            }
    }

  12. #27
    Registered User
    Join Date
    May 2012
    Posts
    18

    Re: [Ask] about Nokia Map API - Java ME

    I have question about downloading Image Map, sir
    How to set the zoom level Image Map view ? I want to set size downloading Image Map.

    and
    when routing , polyline color is only black or can be change? If can be change, how to change color polyline?


    Thank you sir

  13. #28
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    Quote Originally Posted by Arif_Mubashir View Post
    How to set the zoom level Image Map view ? I want to set size downloading Image Map.
    Use map.setState(new MapDisplayState(new GeoCoordinate(51.477, 0.0, 0), 15));
    or map.setZoomLevel(15, 0, 0); to set the zoom level on start up.

    To alter the size of the Image, you'll need to create your own custom MapCanvas, and example is given here:

    http://www.developer.nokia.com/Commu...PI_for_Java_ME


    Quote Originally Posted by Arif_Mubashir View Post
    when routing , polyline color is only black or can be change? If can be change, how to change color polyline?
    MapFactory.createMapPolyline() will give a black line by default. Use MapPolyline.setColor() to alter it to the ARGB color of your choice.

  14. #29
    Registered User
    Join Date
    Aug 2012
    Posts
    1

    Re: [Ask] about Nokia Map API - Java ME

    Hi Arif.
    When i use c.getLatitude() and c.getLongitude(), why my device "searching for device" with bluetooth??i use Asha 300.i think this device support JSR-179
    Thanks

  15. #30
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: [Ask] about Nokia Map API - Java ME

    Hi littlemanz77,

    I think you would be more likely to get a response about a Geolocation issue if you create a new thread here: http://www.developer.nokia.com/Commu...and-Navigation. It would also help if you could supply a snippet of your code.

    This is the wrong discussion board for your question as it is focused on displaying stuff and interacting with the Maps API for Java ME

Similar Threads

  1. Nokia java sdk 1.0 does not find java
    By jkekoni in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2011-08-11, 13:30
  2. Replies: 5
    Last Post: 2011-02-02, 14:40
  3. What version of Java Card is the internal Java Card of Nokia 6212?
    By mmattsso in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2010-03-30, 10:32
  4. Java Nokia 9300 opening JAVA 2.4.3 applet ?
    By bartd914 in forum Mobile Java General
    Replies: 2
    Last Post: 2006-03-31, 18:16
  5. Replies: 0
    Last Post: 2004-09-15, 11:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •