我制作了一个典型的 googlemaps 应用程序。它在大约 2 个月内运行良好,但昨晚我想添加更多功能,结果是 googlemaps 没有出现,只有黑屏。我的应用程序没有吐出任何错误,一切正常,除了 googlemaps 被黑屏取代。为什么会这样?有任何想法吗?
它在模拟器上运行良好,但在我的手机上不行。
谷歌地图活动
public class GoogleMaps extends MapActivity implements LocationListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent1 = new Intent(this, BackGroundService.class);
stopService(intent1);
setContentView(R.layout.googlemaps);
map = (MapView) findViewById(R.id.mvGoogleMaps);
Touchy t = new Touchy();
overlayList = map.getOverlays();
overlayList.add(t);
ourLocation();
d = getResources().getDrawable(R.drawable.round_pointer);
Criteria crit = new Criteria();
towers = locationManager.getBestProvider(crit, false);
Location location = locationManager.getLastKnownLocation(towers);
nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.cancel(uniqueID);
}
谷歌地图布局
<com.google.android.maps.MapView
android:id="@+id/mvGoogleMaps"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="My APY Key"
android:clickable="true"
android:enabled="true" />
显现
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rememberforme"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<application
android:allowBackup="true"
android:icon="@drawable/round_pointer"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.example.rememberforme.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.rememberforme.GoogleMaps" >
</activity>
<activity android:name="com.example.IkkeImplementeret.Situationer" >
</activity>
<activity android:name="com.example.IkkeImplementeret.Tid" >
</activity>
<activity android:name="com.example.rememberforme.Locations" >
</activity>
<service
android:name="com.example.rememberforme.BackGroundService"
android:enabled="true"
android:exported="false"
android:label="LocationLoggerService" />
</application>
</manifest>