I'm developing a Geolocation tool following the geolocation standard
in W3C, And I have this code:
3 files .java as follow:

//NaviatorGeolocation.java
//here all the imports
public class NavigatorGeolocation extends Activity {

        Position position = new Position();
        //Coordinates co = new Coordinates();
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);

           WebView wv = new WebView(this);
           wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
           wv.getSettings().setJavaScriptEnabled(true);

           wv.addJavascriptInterface(position, "position");

           setContentView(wv);
           wv.loadUrl("http://test.libregeosocial.libresoft.es/gwt/
nada.html");
    }
}

//Postion.java
public class Position {
        public long timestamp;
        public Coordinates coords;

        public Position(){
                this.timestamp = 2929;
                coords = new Coordinates();
        }

}

//Coordinates.java
public class Coordinates {

        public double latitude;
        public double longitude;
        public double altitude;
        public double accuracy;
        public double altitudeAccuracy;
        public double heading;
        public double speed;

        public Coordinates(){
                this.latitude = 9.9292;
                this.longitude = 444.21;
                this.altitude = 0.0;
                this.accuracy = 0.0;
                this.altitudeAccuracy = 0.0;
                this.heading = 0.0;
                this.speed = 0.0;
        }
}

My "nata.html" is as follow:

<html>
  <head><title>JS calls Android Method</title></head>
  <body>
    <h1>JS on Android</h1>
    <script type="text/javascript">
        document.write("making tests--");
        document.write("recibido: " + position.coords.latitude);
<--------- not work!!
        document.write("end");
    </script>
  </body>
</html>

I don't now why but the position.coords.latitude, not work, but if I
try "position.timestamp" it works, returning 2929.
I make some test, and it's like the parser of the addJavascripInterface
() don't work with 2 levels of attribute objects. any Idea of this
task?!?! somebody have problems like that?

NavigatorGeolocation creat a Position object --- Position creat a
Coordinates object --- and Coordinates give the data. ( this is the
standard in W3C )

I'm really thinking about that the Android , right now, CAN'T make use
of the standard of geolocation...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to