×
Namespaces

Variants
Actions

Talk:Advanced Routing with Java ME

From Nokia Developer Wiki
Jump to: navigation, search

Contents

Kingassassin - error occur while extending this code in RoutingDemo code

final static Command BACK = new Command("Ok", Command.BACK, 1);

  final static Command PREVIOUS = new Command("Previous", Command.SCREEN, 1);
  final static Command NEXT = new Command("Next", Command.SCREEN, 1);

  • Shows illegal static declaration in inner class ! plzz help

    kingassassin 06:20, 23 February 2012 (EET)

Jasfox -

An inner class is a class which is not defined in its own file. You will get the inner class error you describe if you paste the Code Snippet above directly into the RoutingDemo.java class. It needs to be in a separate class called TurnByTurnForm.java. As your compiler has noticed, inner classes aren't allowed static Command buttons in them.

jasfox 09:47, 24 February 2012 (EET)

Kingassassin -

Thank U so much !! :)

kingassassin 20:34, 25 February 2012 (EET)

Kingassassin -

sir, i m not able to understand where to put " commandAction(final Command c, Displayable d) " method.i m also not able to implement this method ! plzz help me !

kingassassin 19:45, 27 February 2012 (EET)

Jasfox -

In order to interact with Command buttons you need to implement a CommandListener This is the standard MIDP User Interface, an example of which you can see here: MIDP's User Interface Hierarchy: Event Handling - this defines "commandAction(final Command c, Displayable d)"

Set your Form to implement CommandListener and add the code to handle button presses there. In the Examples shipped with the Maps API for Java ME, the CommandListener can be found in the Base class. In the associated routing example http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/Code_examples/#routing the extension to this is called commandRun and is found in the RoutingDemo class.

There are probably other Command Buttons already in your code. Look for something like:

private final Command FOO = new Command ("Bar", Command.OK, 1);

and then search through the code to find where FOO is handled.

jasfox 16:38, 28 February 2012 (EET)

Arif Mubashir -

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

Thank you sir

Arif_Mubashir 09:47, 7 June 2012 (EEST)

 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×