How to get Latitude and Longitude using address?

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

How to get Latitude and Longitude using address?

Postby pranav09 » Tue Jan 12, 2010 3:37 pm

Hi all,

I am developing a google map application. When i start my personal computer and run the application first time, at that time i have to give latitude and longitude manually. Once i give it, after that it displays latitude and longitude otherwise it does not finding any particular location. Actually, i want to get latitude and longitude of the current location when i run my application.

Now the second thing is, i have a EditText in which the user will enter the location and on the basis of that i should directly go to that particular location and it should also display the latitude and longitude of that location.

How can i do that? I got this thing from the "Google Earth" in which the user enter location in the string format and it converts in latitude and longitude and display map to the user. The same thing i want to do.

If anybody have any idea about it. Please share with me.

Thanks.

Regards,
--------------------
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Top

Postby Draffodx » Tue Jan 12, 2010 4:34 pm

For the first part of your message you can only feed false location data to the emulator.

Do you want it so that the location moves to a particular location everytime it starts?

For getting location information about a place from an Address look into the address class supplied by Android

http://developer.android.com/reference/ ... dress.html
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby pranav09 » Wed Jan 13, 2010 2:43 pm

Hi Draffodx,

Thank you for reply me. I got the thing as i want as you suggested me. Now i can enter the string as a input and get the latitude and longitude from that and i am also able to display latitude and longitude.

Now, i have another problem. I want to display the latitude and longitude on the second activity when i press the button of the first activity. How can i do that? Have you any idea regarding it?

Please give me idea to resolve the problem.

Thanks.

Regards,
-----------------
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Postby Draffodx » Wed Jan 13, 2010 4:40 pm

follow this tutorial to pass data to sub activities

http://www.anddev.org/tinytut_-_passing ... -t305.html
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby pranav09 » Sat Jan 16, 2010 8:34 am

Hi Draffodx,

Thanks for such a nice tutorial of sub activity. But i couldn't understand

Code: Select all
For the first part of your message you can only feed false location data to the emulator.


So, can you clarify? How can i do this with the code or any settings?

Thanks.

Regards,
-----------------
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Postby Draffodx » Mon Jan 18, 2010 11:36 am

Have a look at this for sending mock location data to the emulator using a GPX file

http://developer.android.com/guide/topi ... index.html
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 5 guests