title: Cant get Geopoints to add to google map due to; Couldn't get connection factory client
body: <p>I am getting this error while try to plot multiple Geopoint locations onto a google map. I am reading the latitude and longitude from a MySQL database through PHP and JSON.  I have looked at the main examples, such as <a href="https://stackoverflow.com/questions/2199403/couldnt-get-connection-factory-client">Couldn&#39;t get connection factory client</a>, <a href="https://stackoverflow.com/questions/7982320/couldnt-get-connection-factory-client-fighting-with-google-maps">Couldn&#39;t get connection factory client - fighting with Google Maps</a>, <a href="https://stackoverflow.com/questions/6006835/android-mapactivity-couldnt-get-connection-factory-client">Android MapActivity : Couldn&#39;t get connection factory client</a>.<br/>I can confirm it is not an invalid API key as I have generated 2 different keys and returned the same error. It is also not an API level problem either, I tried to run the application on API level 17 and on level 8 and still no joy. When I run the code it displays the map no problem and then gets to my exception toast message of <i>"Error displaying contents"</i><br/> Here is my mapview.java code:<br/></p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  import org.apache.http.HttpEntity;
  import org.apache.http.HttpResponse;
  import org.apache.http.NameValuePair;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.entity.UrlEncodedFormEntity;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import android.graphics.drawable.Drawable;
  import android.net.ParseException;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.Toast;
  
  import java.io.BufferedReader;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  
  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 com.google.android.maps.Overlay;
  import com.google.android.maps.OverlayItem;
  
  public class mapview extends MapActivity 
  {
  
  //protected MapView mapview;
  
  JSONArray jarray;
  String result=null;
  InputStream is=null;
  StringBuilder sb=null;
  
  double LAT;
  double LNG;
  
  public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.mapview);
  
      MapView mapview = (MapView) findViewById(R.id.mapview);
      mapview.setBuiltInZoomControls(true);
  
      //ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
  
      try 
      {
  
           HttpClient httpclient = new DefaultHttpClient();
           HttpPost httppost = new HttpPost("http://10.0.2.2/displaymarkers.php");
           //httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
           HttpResponse response = httpclient.execute(httppost);
           HttpEntity entity = response.getEntity();
           is = entity.getContent();
  
      }
  
      catch(Exception e)
      {
          Log.e("log_tag", "Error in http connection"+e.toString());
      }
  
  
          try{        
  
  
          jarray = new JSONArray("$json_output[]");
          JSONObject json_data = null;
                  for(int i = 0; i &lt; jarray.length(); i++)
                  {
                      json_data = jarray.getJSONObject(i);
  
                      LAT=json_data.getDouble("lat");
                      LNG=json_data.getDouble("lng");
  
                      GeoPoint point = new GeoPoint((int)(LAT * 1E6), (int)(LNG * 1E6));
                      OverlayItem overlayitem = new OverlayItem(point, "TEXT", null);
  
                      List&lt;Overlay&gt; mapOverlays = mapview.getOverlays();
                      Drawable drawable = this.getResources().getDrawable(R.drawable.marker);
                      myItemizedOverlay itemizedoverlay = new myItemizedOverlay(drawable, this);
  
                      MapController mapController = mapview.getController();
  
                      //mapController.animateTo(point);
                      mapController.setZoom(8);
  
                      itemizedoverlay.addOverlay(overlayitem);
                      mapOverlays.add(itemizedoverlay);
                  }
              }
              catch(JSONException e1)
              {
              Toast.makeText(getBaseContext(), "Error displaying contents" ,Toast.LENGTH_LONG).show();
              }       
                  catch (ParseException e1) 
                  {
                  e1.printStackTrace();
                  }   
      }
      @Override
      protected boolean isRouteDisplayed() 
      {
          return false;
      }
  }
  </code></pre>
  
  <p>This is my ItemizedOverlay.java code:</p>
  
  <pre><code>    import java.util.ArrayList;
  
      import android.app.AlertDialog;
      import android.content.Context;
      import android.graphics.drawable.Drawable;
  
      import com.google.android.maps.OverlayItem;
      import com.google.android.maps.ItemizedOverlay;
  
  
      public class myItemizedOverlay extends ItemizedOverlay 
      {
  
          private ArrayList&lt;OverlayItem&gt; mapOverlays = new ArrayList&lt;OverlayItem&gt;();
          private Context mContext;
  
          public myItemizedOverlay(Drawable marker, Context context) 
          {
              super(boundCenterBottom(marker));
              mContext = context;
  
          }
  
          public void addOverlay(OverlayItem overlay) 
          {
              mapOverlays.add(overlay);
              this.populate();
          }
  
  
          @Override
          protected OverlayItem createItem(int i) 
          {
            return mapOverlays.get(i);
          }
  
          @Override
          public int size() 
          {
              return mapOverlays.size();
          }
  
          @Override
          protected boolean onTap(int index) 
          {
            OverlayItem item = mapOverlays.get(index);
            AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
            dialog.setTitle(item.getTitle());
            dialog.setMessage(item.getSnippet());
            dialog.show();
            return true;
          }
  
      }
  </code></pre>
  
  <p>I would appreciate any help I get, thanks in advance.</p>