locationmanager,getLatitude function

by CSUIDL PROGRAMMEr » Thu, 23 Oct 2008 19:31:57 GMT

Sponsored Links
I am a newbie android developer. I am trying to simulate gps
functionality in android sdk 1.0.

I am using location manager  to get getlatitude function.


I am loading a google kml  through my ddms.

I get a java null pointer exception.
What am i doing wrong here



locationmanager,getLatitude function

by Mast3rpyr0 » Thu, 23 Oct 2008 21:19:09 GMT

 does getLastKnownLocation have a location to give yet? try running
maps first then run your app


Sponsored Links

locationmanager,getLatitude function

by nkijak » Thu, 23 Oct 2008 21:24:48 GMT


I updated your code on that site to be more "correct". You should
stick with the static variable instead of hardcoding the string "gps".

You get a null pointer because you have to provide a location first,
meaning run the KML, then you can call getLastKnownLocation. When the
emulator starts, without being given a coordinate, it has no last
location. So try running the KML then running your app.

If you are trying to get continuous updates of location you should
implement LocationListener instead.



locationmanager,getLatitude function

by CSUIDL PROGRAMMEr » Mon, 03 Nov 2008 12:26:17 GMT

 Hello nkijak,
I could not find your upated code.
Also, i tried running the maps, ( including kml file, manually sending
decimal) .But the Nullpointer exception exists.
Is there anyone here who as got gps simulation working in android


Other Threads

1. Getting the Model Number field

In Settings > About phone there is a field Model Number which now
obviously says "T-Mobile G1". But to already be device-independent for
the future, is there a way in the SDK to get this field. I will not be
using it to identify the device but simply to form a string that says
"I am running Android on my [Model Number]"


2. Taking Camera Pictures in app

Still trying to figure this out, but not getting anywhere on it.

Does taking a picture using the camera only require creating the
Camera.PictureCallback for onPictureTaken() and passing it into
Camera.takePicture() as an input?  Or do you have to stop the preview,
lock the canvas, and convert/extract data from there to get it into a
writable form?

I'm fine with the first one, but completely confused as to how to do
the latter.

Also, is taking pictures in the emulator functional or not?  I tried
to run CameraApiTest and it crashes hard whenever I hit spacebar, even
though I have an SD card instantiated.

3. why would android call oncreate when flipping the keyboard

4. install application from sdcard, how?!

5. chmod unexpected permission error when logged into an actual device

6. Viewing Market Comments

7. Suggestion