2011-04-05 85 views
0

我正在嘗試訪問Android活動中特定點的谷歌地圖。我的模擬器與互聯網連接。 我也給互聯網權限manifest.xml文件。但我的程序無法連接到互聯網。只顯示網格線,但沒有地圖。我找不到任何錯誤。請幫我out.here是我的代碼有問題在Android中連接互聯網

super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 

    mv=(MapView)findViewById(R.id.mapView); 

    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom); 
    View zoomView = mv.getZoomControls(); 

    zoomLayout.addView(zoomView, 
     new LinearLayout.LayoutParams(
      LayoutParams.WRAP_CONTENT, 
      LayoutParams.WRAP_CONTENT)); 
    mv.displayZoomControls(true); 


    mc=mv.getController(); 
    String coordinates[] = {"1.352566007", "103.78921587"}; 
    double lat = Double.parseDouble(coordinates[0]); 
    double lng = Double.parseDouble(coordinates[1]); 

    p=new GeoPoint((int)(lat*1E6),(int)(lng*1E6)); 
    mc.animateTo(p); 
    mc.setZoom(17); 
    mv.invalidate(); 

我的manifest.xml

<?xml version="1.0" encoding="utf-8"?> 

<application android:icon="@drawable/icon" android:label="@string/app_name"> 
    <uses-library android:name="com.google.android.maps"></uses-library> 
    <activity android:name=".geo_loc" 
       android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 


</application> 

+0

它與debug.keystore相關,而不是與互聯網連接。這已經被處理了很多次,只是試圖做一個更好的搜索。 – Cristian 2011-04-05 17:41:18

+0

我能看到這個debug.keystore谷歌地圖,但在這個程序中我有問題。 – DPD 2011-04-05 17:47:21

+0

如果你得到的網格線沒有映射,那麼你要麼使用釋放apk的調試api鍵,反之亦然。 – 2011-04-05 17:49:45

回答

0

你最有可能需要一個Maps API密鑰。如果您認爲自己已經擁有Google地圖API密鑰,但仍然無法解決問題,請發佈清單.xml文件