0

Googleマップ画面で問題が発生しています。空白のGoogleマップ画面が表示され、画面全体にタイルが含まれていますマップが生成されていません

私はすべての設定を適切に行いましたが、同じ問題に対してネットから解決策を取得しても、問題を解決できません。

AndroidManifest.xml

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

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gmaptest5"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="17" />    

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name="com.example.gmaptest5.Gmap5MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

  <uses-library android:name="com.google.android.maps"/>
    <meta-data
  android:name="com.google.android.maps.v2.API_KEY"
  android:value="MY API KEY"/>

  </application>

 <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 <uses-permission     android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

  <uses-feature
  android:glEsVersion="0x00020000"
  android:required="true"/>

 <permission
  android:name="com.example.gmaptest5.permission.MAPS_RECEIVE"
  android:protectionLevel="signature"/>
 <uses-permission android:name="com.example.gmaptest5.permission.MAPS_RECEIVE"/> 

 </manifest>

Main.xml

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
 >
 <com.google.android.maps.MapView
     android:id="@+id/mapview1"
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:enabled="true" 
     android:clickable="true" 
  android:apiKey="MY API KEY" />

 </LinearLayout>

Main.Java

   public class Gmap5MainActivity extends MapActivity {
private MapView myMapView;
LocationManager locationManager;
private Location myLocation;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gmap5_main);

    myMapView = (MapView)findViewById(R.id.mapview1);
    double lat = 19.7888;
       double longi = 52.535;        

      GeoPoint p = new GeoPoint((int) (lat *1E6),(int) (longi *1E6));
    //GeoPoint p = new GeoPoint((int) (location.getLatitude()* 1000000), (int)  (location.getLatitude()* 1000000));
    MapController mc = myMapView.getController();

    mc.setZoom(18);
    mc.animateTo(p);
    // Enable Sattelite-Mode
    myMapView.setSatellite(true);
    myMapView.getMapCenter();
    myMapView.setBuiltInZoomControls(true);
    myMapView.displayZoomControls(true);
    myMapView.invalidate();   
    myMapView.getOverlays();
    myMapView.getProjection();      
    this.myLocation = new Location("gps");
    this.myLocation.setLongitude(77.52436144125092);
    this.myLocation.setLatitude(13.05096452223662);
    Double lat1 = myLocation.getLatitude();
    Double longi1 = myLocation.getLongitude();
    GeoPoint point = new GeoPoint(lat1.intValue(), longi1.intValue());
    mc.setCenter(point);*/
}
    public boolean onKeyDown(int keyCode, KeyEvent event) 
    {
    if (keyCode == KeyEvent.KEYCODE_I) {
    myMapView.getController().setZoom(myMapView.getZoomLevel() + 1);

    return true;
    } else if (keyCode == KeyEvent.KEYCODE_O) {
    myMapView.getController().setZoom(myMapView.getZoomLevel() - 1);
    return true;
    } else if (keyCode == KeyEvent.KEYCODE_S) {
    myMapView.setSatellite(true);
    return true;
    } else if (keyCode == KeyEvent.KEYCODE_T) {
    myMapView.setSatellite(false);
    myMapView.setTraffic(true);
    return true;
    }
    return false;
    }

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_gmap5_main, menu);
    return true;
}

@Override
protected boolean isRouteDisplayed() {
    return false;
}
  }
4

1 に答える 1

0

あなたはと混合Google Map API V1しています、あなたがあなたのファイルでそれが見えるAPI V2ように使用したいなら、あなたは私があなたのアプリケーションに追加する方法について書いたこのブログ投稿をチェックすることができます:Google Map V2ManifestGoogle map API V2

Google Map API V2 Android

使用する場合は、現在使用するように設定されているファイルAPI V1を変更する必要があります。次のリンクをたどってください。ManifestAPI V2

https://developers.google.com/maps/documentation/android/v1/hello-mapview

于 2013-03-16T15:34:19.997 に答える