locationmanager,getLatitude function

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


Sponsored Links
 Hello,
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.

 http://pastebin.com/m56feb30c 

I am loading a google kml  through my ddms.

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

Thanks

--~--~---------~--~----~------------~-------~--~----~



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


 Hello,

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.

Nick



--~--~---------~--~----~------------~-------~--~----~



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
here.
Thanks




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. 3d flip between two views

Hello,
Is there an easy way to perform a 3d flip animation (on the x-axis)
between two views?
So i have a view ( actually a viewgroup) and an ImageView... By
tapping on the Image the image should flip 180* and the other view
should be desplayed.

I looked through this code
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/animation/Rotate3dAnimation.html
which shows how a 3d rotate animation on a view can be performed...
How should I adapt this code so that it flips between 2 views?

or is there an easier way to do this?

greets

-- 

2. Problem with view alignment and image size

Hi,
I have to show a image in vertically center on the screen. The image is
originally of big size, but I reduce it and display it.
Problem is I have to maintain the ratio of the image like example.
Original image is of 200 X 400, then I might reduce it 100 X 200.
Again if Image is of 500 X 200 then I might reduce it 250 X 100.


Problem is that My Image doesn't have fixed width or height. How can i
keep it such a way that Whenever image loads it should be vertically
centered.
I tried setting android:layout_centerVertical in xml, but it doesn't
work as in xml I have to pass layout height and width. But as i said my
height / width
of image is not fixed.


Please help me with this case.

-- 

3. Locking the notification drawer

4. Authorizing Purchase problem

5. Detecting the result of the enter key

6. Android Power Driver Issue

7. ArrayList example