Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7972849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:57:46+00:00 2026-06-04T07:57:46+00:00

i write a map viewer and i want to get Latitude and Longitude from

  • 0

i write a map viewer and i want to get Latitude and Longitude from user, then show him the location.
i use menu for this work. but i don’t know how show him something to enter the values. this is my code.

public class main extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    MapView view = (MapView) findViewById(R.id.themap);
    view.setBuiltInZoomControls(true);

    final MapController control = view.getController();

    LocationManager manager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
    LocationListener listener = new LocationListener() {

        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onProviderEnabled(String provider) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onProviderDisabled(String provider) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onLocationChanged(Location location) {
            control.setCenter(new GeoPoint((int)location.getLatitude(), (int)location.getLongitude()));
        }
    };
    manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    return super.onOptionsItemSelected(item);
}

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}

}

so i have 2 questions. first how can i create a menu for my locations. i must use context menu or something else.
second, if i get locations, i can enter them directly to my Latitude and Longitude?
in my code i use the default location of user.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:57:47+00:00Added an answer on June 4, 2026 at 7:57 am

    Well if I am understanding you correctly you can do this 2 ways.

    1) In your xml layout add an input box and button then on click set your location.

    2) Override your onTouch and have and alert box pop up and ask for the long and lat. Then set it accordingly.

    Both these will be setting your overLay: http://developer.android.com/resources/tutorials/views/hello-mapview.html

    one of many overlay tutorials: http://eagle.phys.utk.edu/guidry/android/mapOverlayDemo.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a map/reduce job to select a number of random samples
I write this in api v2: map.enableGoogleBar(); I want to using v3, but I
I have to write a program who use collection for implementing a map in
I want to write a map-like object type in PL/SQL. What I mean is
How can I convert my Map<Integer, String > to byte[] , and then write
I want keep my js in this style. I want write a map in
In short, if you want to write a map of e.g. constants in Java,
I am newbie to write couchdb map and reduce queries. One of my requirements
I'm trying to write std::map container where key has 2 values. Here is the
I'm trying to write a map editor in Qt, using QGraphicsView and QGraphicsScene for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.