title: Geocoder getAddressLine(0) works, but not getLocality()?
body: <p>I'm trying to get users city by location, but I can't get ONLY the City! </p>
  
  <p>I tried pretty much everything I believe but nothing seem to work, or, actually, the only thing working for getting user-info by location is "getAddressLine(0)".</p>
  
  <p>Below is code</p>
  
  <pre><code>        Geocoder geocoder;
          List&lt;Address&gt; addresses;
          geocoder = new Geocoder(context, Locale.getDefault());
  
          String city="unknown";
  
          try {
              addresses = geocoder.getFromLocation(mLastLocation.getLatitude(), mLastLocation.getLongitude(), 1);
  
          } catch (Exception e) {
  
              Log.d(TAG, "getAddress failed: " + e.getMessage());
              e.printStackTrace();
              return "Couldn't find city!";
          }
  
          if(addresses != null &amp;&amp; addresses.size() &gt; 0) {
  
              city = addresses.get(0).getAddressLine(0); // Returns full address!
  
              // city = addresses.get(0).getLocality(); // Returns only an empty string " ".
          }
  
          return city;
  </code></pre>
  
  <p>So, I wonder how I could get only CITY and not full address. Also, WHY is "getLocality()" returning an useless empty string?</p>
  
  <p>I'm still wonder why is getLocality() don't work, </p>
  
  <p>but I created a temporarily solution as below code: </p>
  
  <pre><code>if(addresses != null &amp;&amp; addresses.size() &gt; 0) {
  
          String address = addresses.get(0).getAddressLine(0);   // StreetAddress -&gt; StreetAddress Number -&gt; Postal Code -&gt; City -&gt; Country
          String[] splitAddress = address.split(" ");     // Splits address where there is a space, creating array with 5 index. Index 4 should be CITY!
  
          city=splitAddress[4].substring(0,splitAddress[4].length()-1);   // Saves city into city-string, and removes a comma from the getAddressLine(0)!
  
          Log.d("SplittedAddress", Arrays.toString(splitAddress));
      }
  </code></pre>