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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:09:34+00:00 2026-05-25T21:09:34+00:00

Friends… i’m woking on a project on geocoding.I tried to implement it several times.But

  • 0

Friends…
i’m woking on a project on geocoding.I tried to implement it several times.But i’m not able to retrieve the latitude and longitude values corresponding to a location.Please help me out to complete my project..

  • 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-05-25T21:09:35+00:00Added an answer on May 25, 2026 at 9:09 pm

    try this code hope this will help you:

    package com.example.map;  
    import java.util.List;
    import com.google.android.maps.GeoPoint;  
    import com.google.android.maps.MapActivity;   
    import com.google.android.maps.MapController;  
    import com.google.android.maps.MapView;  
    import android.app.AlertDialog;  
    import android.app.Dialog;  
    import android.location.Address;  
    import android.location.Geocoder;  
    import android.os.Bundle;  
    import android.view.View;  
    import android.view.View.OnClickListener;  
    import android.widget.Button;  
    import android.widget.EditText; 
    
    public class mapView extends MapActivity{
    
    MapView myMap;
    Button btnSearch;
    EditText adress;
    Geocoder gc;
    double lat;
    double lon;
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        myMap = (MapView) findViewById(R.id.simpleGM_map); // Get map from XML
        btnSearch = (Button) findViewById(R.id.simpleGM_btn_search); // Get button from xml
        adress = (EditText) findViewById(R.id.simpleGM_adress); // Get address from XML
    
        gc = new Geocoder(this); // create new geocoder instance
        btnSearch.setOnClickListener(new OnClickListener() 
        {
            public void onClick(View v)
            {
                String addressInput = adress.getText().toString(); // Get input text
    
                try 
                {
    
                    List<Address> foundAdresses = gc.getFromLocationName(
                            addressInput, 5); // Search addresses
    
                    if (foundAdresses.size() == 0) 
                    { // if no address found,
                        // display an error
                        Dialog locationError = new AlertDialog.Builder(
                                mapView.this).setIcon(0).setTitle(
                                "Error").setPositiveButton(R.string.ok, null)
                                .setMessage(
                                        "Sorry, your address doesn't exist.")
                                .create();
                        locationError.show();
                    } 
                    else 
                    { // else display address on map
                        for (int i = 0; i < foundAdresses.size(); ++i) 
                        {
                            // Save results as Longitude and Latitude
                            // @todo: if more than one result, then show a
                            // select-list
                            Address x = foundAdresses.get(i);
                            lat = x.getLatitude();
                            lon = x.getLongitude();
                        }
                        navigateToLocation((lat * 1000000), (lon * 1000000),
                                myMap); // display the found address
                    }
                } 
                catch (Exception e) 
                {
                    // @todo: Show error message
                }
    
            }
        });
    }
    
    
    @Override
    protected boolean isRouteDisplayed() 
    {
        // TODO Auto-generated method stub
        return false;
    }
    
    
    /
     * Navigates a given MapView to the specified Longitude and Latitude          
     * @param latitude
     * @param longitude
     * @param mv
     */
    public static void navigateToLocation(double latitude, double longitude,
            MapView mv) 
    {
        GeoPoint p = new GeoPoint((int) latitude, (int) longitude); // new
        // GeoPoint
        mv.displayZoomControls(true); // display Zoom (seems that it doesn't
        // work yet)
        MapController mc = mv.getController();
        mc.animateTo(p); // move map to the given point
        int zoomlevel = mv.getMaxZoomLevel(); // detect maximum zoom level
        mc.setZoom(zoomlevel - 1); // zoom
        mv.setSatellite(false); // display only "normal" mapview
    
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Friends, I know how to deploy and retrieve a single element in LINQ, but
Friends, I do not succeed to create Javadocs for my Android project. What I
Friends I was making a calculator like project so It is a full webpage
Friends, My apex page has several different radio groups, each one can have the
Friends, Previously I have worked with EJB-WEBSTART CLIENT project, and Now i have joined
Friends, I am able to get XML file by sing bytes, perhaps which is
Friends, I am working to implement online purchasing with credit card,how can i implement
Friends, I am building and debugging my xproj. Now the control is not stopping
Friends, I have an application, ten pages, but full of buttons(with background images), big
friends, i have problem in calling notifydatasetchanged(); it is giving me exception source not

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.