Unable to convert GeoPoint to Address
<p>Im trying to reverse a GeoPoint object from its Lat and Long values to an actual string address.</p>

<p>So far, I pass the GeoPoint object to a method, the lat and long value are extracted, the address is stored in an array, the first address is set to a 'add' string variable and reutned to be set with an alert dialog..</p>

<p>This is show GeoPoint 'p' is sent and how the method is called:</p>

<pre><code>String address = convertGpToLoc(point);

city.setText("Address: " +  address + "");
</code></pre>

<p>CityClickListner class:</p>

<pre><code>class CityClickListener extends Activity implements OnClickListener {


    private GeoName geoName = null;

    CityClickListener(GeoName name) {
        this.geoName = name;
    }

    @Override
    public void onClick(View v) {


        Double Lattt = geoName.getGeometry().getLocation().getLat();
        Double Longgg = geoName.getGeometry().getLocation().getLng();
        updateMap(Lattt, Longgg); 

        AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
        builder.setView(createView());
        builder.setTitle("Details of " + geoName.getName());

        builder.setCancelable(true);

        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                   dialog.cancel();
               }
        });

        AlertDialog alert = builder.create();
        alert.show();

    }
</code></pre>

<p>convertGpToLoc method:</p>

<pre><code>public String convertGpToLoc(GeoPoint p)
    {
        String add = "";
        try {

            Geocoder gc = new Geocoder(CityClickListener.this, Locale.ENGLISH);

            List&lt;Address&gt; addresses = gc.getFromLocation(
                p.getLatitudeE6()  / 1E6, 
                p.getLongitudeE6() / 1E6, 1);


            if (addresses.size() &lt; 0) 
            {
               return null;
            }

            else
            {

                for (int i=0; i&lt;addresses.get(0).getMaxAddressLineIndex(); i++)
                {
                      add += addresses.get(0).getAddressLine(i) + "\n";
                }

            }

        }
        catch (IOException e)
        {                
            e.printStackTrace();
        }

        return add;  

        }
</code></pre>

<p>LogCat:</p>

<pre><code>03-11 15:16:10.952: E/AndroidRuntime(304): FATAL EXCEPTION: main
03-11 15:16:10.952: E/AndroidRuntime(304): java.lang.NullPointerException
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.content.ContextWrapper.getPackageName(ContextWrapper.java:120)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.location.GeocoderParams.&lt;init&gt;(GeocoderParams.java:50)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.location.Geocoder.&lt;init&gt;(Geocoder.java:64)
03-11 15:16:10.952: E/AndroidRuntime(304):  at com.example.restfulweb.PostalCodeAdapter$CityClickListener.convertGpToLoc(PostalCodeAdapter.java:207)
03-11 15:16:10.952: E/AndroidRuntime(304):  at com.example.restfulweb.PostalCodeAdapter$CityClickListener.createView(PostalCodeAdapter.java:175)
03-11 15:16:10.952: E/AndroidRuntime(304):  at com.example.restfulweb.PostalCodeAdapter$CityClickListener.onClick(PostalCodeAdapter.java:1 14)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.view.View.performClick(View.java:2408)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.view.View$PerformClick.run(View.java:8816)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.os.Handler.handleCallback(Handler.java:587)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.os.Handler.dispatchMessage(Handler.java:92)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.os.Looper.loop(Looper.java:123)
03-11 15:16:10.952: E/AndroidRuntime(304):  at android.app.ActivityThread.main(ActivityThread.java:4627)
03-11 15:16:10.952: E/AndroidRuntime(304):  at java.lang.reflect.Method.invokeNative(Native Method)
03-11 15:16:10.952: E/AndroidRuntime(304):  at java.lang.reflect.Method.invoke(Method.java:521)
03-11 15:16:10.952: E/AndroidRuntime(304):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-11 15:16:10.952: E/AndroidRuntime(304):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-11 15:16:10.952: E/AndroidRuntime(304):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>
