Am trying to dispaly a basic google map on my application but that’s not working it display a white screen instead even though I have a net connection also I check my MANEFIST a hundred times and I genrated a deubg key and am sure it is true
I would like if anyone could lead me what am doing wrong ?
I also haven’t modified the code but for a second on the EMULATOR the map diplayed and disappeared and on my device it doesn’t AT ALL suddenly it doesn’t display AT ALL on the emulator.
public class MyMapDisplayActivity extends MapActivity {
MapController MControl;
GeoPoint GeoP;
MapView mapview;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Map
MapView mapview = (MapView) findViewById(R.id.mapview);
mapview.displayZoomControls(true);
mapview.setBuiltInZoomControls(true);
double lat = 19.7888;
double longi = 52.535;
GeoP = new GeoPoint ((int) (lat *1E6),(int) (longi *1E6));
MControl = mapview.getController();
MControl.animateTo(GeoP);
MControl.setZoom(14);
MyLocationOverlay LocationOverlay = new MyLocationOverlay(this, mapview);
mapview.getOverlays().add(LocationOverlay);
LocationOverlay.enableCompass();
LocationOverlay.enableMyLocation();
}//onCreate
//Map
@Override
protected boolean isRouteDisplayed() {
return false;
}
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tab2"
android:orientation="vertical"
android:paddingTop="60px"
>
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0jiwJEbT6if6dhaf0x6Fr_zRLsrz_CYxcLGj6pQ"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jdisplay.map"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".BatteryprojectActivity"
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" />
</application>
</manifest>
You have to create two different API keys, one with the debug signing key for the emulator and one with the key you use to sign the apk for the device.