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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:30:54+00:00 2026-05-22T12:30:54+00:00

Geocoder g = new Geocoder(this, Locale.getDefault()); java.util.List<android.location.Address> result = null; // testing try{ result

  • 0
Geocoder g = new Geocoder(this, Locale.getDefault());
    java.util.List<android.location.Address> result = null;

    // testing

    try{
        result = g.getFromLocation(43.324722,21.903333, 1);
        if (result.size() > 0) {
            selectedCity = result.get(0).getLocality();
        }else
            //no city found
        }catch(Exception ex)
        {

        }

i am using above code to get city value in android but it always show no city found any one guide me what could be the 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-05-22T12:30:54+00:00Added an answer on May 22, 2026 at 12:30 pm
    public void getAddress(double lat, double lng) {
        Geocoder geocoder = new Geocoder(this, Locale.getDefault());
        try {
            List<Address> addresses = geocoder.getFromLocation(lat, lng, 1);
            Address obj = addresses.get(0);
            String add = obj.getAddressLine(0);
            GUIStatics.currentAddress = obj.getSubAdminArea() + ","
                    + obj.getAdminArea();
            GUIStatics.latitude = obj.getLatitude();
            GUIStatics.longitude = obj.getLongitude();
            GUIStatics.currentCity= obj.getSubAdminArea();
            GUIStatics.currentState= obj.getAdminArea();
            add = add + "\n" + obj.getCountryName();
            add = add + "\n" + obj.getCountryCode();
            add = add + "\n" + obj.getAdminArea();
            add = add + "\n" + obj.getPostalCode();
            add = add + "\n" + obj.getSubAdminArea();
            add = add + "\n" + obj.getLocality();
            add = add + "\n" + obj.getSubThoroughfare();
    
            Log.v("IGA", "Address" + add);
            // Toast.makeText(this, "Address=>" + add,
            // Toast.LENGTH_SHORT).show();
    
            // TennisAppActivity.showDialog(add);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
        }
    }
    

    I am using this function for getting all the information related to latitude and longitude just pass the latitude and longitude in this function then you find your answer.
    I hope this is very help full to you.

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

Sidebar

Related Questions

package net.learn2develop.PopularAttractions; import java.io.IOException; import java.util.List; import java.util.Locale; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController;
i am creating a Geocoder object like. Geocoder geoCoder = new Geocoder(getBaseContext(), Locale.getDefault()); here
I'm using the android.location.Geocoder for the first time. The Idea is: I have a
I have found this code for reverse geocoding: var point = new GLatLng (lat[1],long[1]);
I have noticed that my geocoder is inconsistent in the code shown below because
I am trying to write a simple location lookup call with jQuery and the
I have been looking over this code for the past hour, I cant see
I need to geocode around 200 addresses per request and do around 3,000 request
I have displayed the map in my app by using the following code. I
I'm using Google Maps' local search, to find businesses in the area of an

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.