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 8739389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:55:47+00:00 2026-06-13T10:55:47+00:00

I need to implement the search function on my custom map application like it

  • 0

I need to implement the search function on my custom map application like it is done in native google maps(the action bar turns into search field and you can write your query). Now I know how to use google geocoding api, and how to retrieve location from data. But I have failed to implement that changable actionbar.

My app looks like that:

enter image description here

And after I push the search button I would like to have this kind of layout displayed:

enter image description here

Thanks for the help, hopefully you can solve my problem.

  • 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-13T10:55:48+00:00Added an answer on June 13, 2026 at 10:55 am

    Here is some code for your search facility. This code work with me. If you enter the location name, this will redirect you on the map to the exact match place. The following code provide two way of searching, first by Name and second by LatLang.

    1. By Name og Location

      public void searchPlace()
      {       
      
          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);    // create mapController object like `MapController mc = mapView.getController();`
                      mapView.invalidate();
                  }    
              } catch (IOException e) {
                  e.printStackTrace();
              }
      
      
            }
          });
      
          alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
              // Canceled.
            }
          });
      
          alert.show();
      
      }  
      
    2. By LAtLang.

      public void byLatLang()
      {       
      
          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.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();
      
      }  
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to implement a Query Object Pattern in Java for my customizable search
I need to implement an efficient excel-like app. I'm looking for a data structure
I'm trying to implement a Search-Function using c++ and libpqxx. But I've got the
I'd like to implement a simple AJAX function locally that allows me to autocomplete
In Google Maps, when you click the search box the real search comes up.
I need a simple way to implement the contains function using matches . I
I'm trying to implement a search function into my website, which is running on
I'm still trying to implement a search function into my Android app. So far
My function to implement the search is below. The issue I have is I
I need to implement the following function. I'm open to using the best class,

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.