0

I'm building an app to "store" the latitude and longitude in Android. I've been through various posts as to how to retrieve location using Location Manager. But I couldn't really figure out how to store the latitude and longitude on the device or on the server.

Following is the screenshot of the app-activity which is one of the several screens in this survey app.

enter image description here

So, when/after I enter the address (full address with city/district name) in the edittext field, I call the Location Manager. But how do I store the retrieved latitude and longitude in the provided edittext fields?

Any help would be highly appreciated. Thanks in advance.

Ghost
  • 3,966
  • 1
  • 25
  • 36
  • 1
    What are you asking? How to get the value from the edittext field or how to put the value inside a field or how to put it to sd or how to send it over the internet? PLEASE MORE SPECIFIC! – Warpzit Dec 15 '11 at 07:54

2 Answers2

1

After retrieving latitute/longitude from the location manager, you can set the values inside the EditText by using setText() method.

txtLatitude.setText(strLatitude);
txtLongitude.setText(strLongitude);
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
1

By using getText() on the textfield you can get the field into a variable from the textfield. Here's a great example: Get Value of a Edit Text field

myTextField.getText().toString();

If you want to store it on a server you need to create a connection to a server Service or to a server script that will insert the data for you in a database. If you wish to store it locally you can use the local SQLLite server.

Here is some more info about working with the local SQL database: How to bookmark a webpage in an Android application?

Community
  • 1
  • 1
span
  • 5,405
  • 9
  • 57
  • 115
  • Thanks for the help! I've read articles on how to store any values in local SQLite or store the values on a server. Will try these solutions and let you know in few days. I'm actually still learning java. – Ghost Dec 15 '11 at 08:02
  • Cool, I hope you enjoy learning Java. It's a very nice language :D. Here are some great tutorials on Java if you wish to get to know more, they also have some great Android tutorials: http://www.wibit.net/curriculum/courses/programming_java – span Dec 15 '11 at 08:03