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

  • Home
  • SEARCH
  • 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 7882565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:18:57+00:00 2026-06-03T04:18:57+00:00

I want display Google maps in the Android Based on the user edit text

  • 0

I want display Google maps in the Android Based on the user edit text value lat and lang and place name and then i finally click on the search button the maps was displayed in Android.

  • 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-03T04:18:58+00:00Added an answer on June 3, 2026 at 4:18 am

    you need to create some object like.

    MapView mapView; 
    MapController mc;
    GeoPoint p;
    String add = "";
    double lattitude ;
    double longitude;
    

    Searching location by Name and show Maps.

     AlertDialog.Builder alert = new AlertDialog.Builder(this);
    
            alert.setTitle("Search Location");
            alert.setMessage("Enter Location Name: ");
    
            // Set an EditText view to get user input 
            final EditText input = new EditText(this);
            alert.setView(input);
    
            alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
              String value = input.getText().toString();
              // Do something with value!
              Log.d("value", value);
    
              Geocoder geoCoder = new Geocoder(getBaseContext(), Locale.getDefault());    
                try {
                    List<Address> addresses = geoCoder.getFromLocationName(
                        value, 5);
                    String add = "";
                    if (addresses.size() > 0) {
                        p = new GeoPoint(
                                (int) (addresses.get(0).getLatitude() * 1E6), 
                                (int) (addresses.get(0).getLongitude() * 1E6));
                        mc.animateTo(p);    
                        mapView.invalidate();
                    }    
                } catch (IOException e) {
                    e.printStackTrace();
                }
    
    
              }
            });
    
            alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                // Canceled.
              }
            });
    
            alert.show();
    
        }
    

    Searching location by Entering Latitude and Longitude and show map..

        searchUsingLangLat()
        {       
    
            LayoutInflater factory = LayoutInflater.from(this);            
            final View textEntryView = factory.inflate(R.layout.latlong, null);
    
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
    
            alert.setTitle("Search Location");
            alert.setMessage("Enter Lattitude and Longitude: ");
    
            alert.setView(textEntryView); 
            // Set an EditText view to get user input
            AlertDialog latLongPrompt = alert.create();
    
            final EditText lat = (EditText) textEntryView.findViewById(R.id.lat);
            final EditText longi = (EditText) textEntryView.findViewById(R.id.longi);
        //alert.setView(lat);
            //alert.setView(longi);
    
            alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
    
                Toast.makeText(getBaseContext(), "clicked ok ", Toast.LENGTH_SHORT).show();
              Double value1 = Double.parseDouble(lat.getText().toString());
              Double value2 = Double.parseDouble(longi.getText().toString());
              // Do something with value!
             // Log.d("value1", value1);
              //Log.d("value2", value2);
    
              p = new GeoPoint(
                        (int) (value1 * 1E6), 
                        (int) (value2 * 1E6));
    
                    mc.animateTo(p);
                    mc.setZoom(17); 
                    mapView.invalidate();
    
    
              }
            });
    
            alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                // Canceled.
              }
            });
    
            alert.show();
    

    And finally you need to show map. write following code in onCreate() method.

    mapView = (MapView) findViewById(R.id.mapView);
        LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
        View zoomView = mapView.getZoomControls(); 
    
        zoomLayout.addView(zoomView, 
            new LinearLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT, 
                LayoutParams.WRAP_CONTENT)); 
        mapView.displayZoomControls(true);
    
        mc = mapView.getController();
        String coordinates[] = {"1.352566007", "103.78921587"};
        double lat = Double.parseDouble(coordinates[0]);
        double lng = Double.parseDouble(coordinates[1]);
    
        p = new GeoPoint(
            (int) (lat * 1E6), 
            (int) (lng * 1E6));
    
        mc.setCenter(p);
        mc.setZoom(17); 
    
        //---Add a location marker---
        MapOverlay mapOverlay = new MapOverlay();
        List<Overlay> listOfOverlays = mapView.getOverlays();
        listOfOverlays.clear();
        listOfOverlays.add(mapOverlay);      
    
    
        LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this);
    

    Try this code…if you get any error free to ask.

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

Sidebar

Related Questions

I am new to working with google maps. I want to display a map
I'm new to google maps in android. I want a functionality like, on the
I use the google maps family API. I want to display a car on
In fact, all is in the title, i succeed to display Google Maps based
I want to display google maps (mutliple markers etc) and just found that there
I want to display some animation on infoWindow in google maps with jQuery. var
I want to display on my website something similar to google maps transit directions,
Hi I want to display flight paths in Google maps. I have the geo
I am using Google Maps in a project and I want to display only
I want to use to UIWebView to display google maps mobile website for my

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.