J
jomo
Neues Mitglied
- 0
Hallo,
ich bin neu beim programmieren in Android und habe ein Problem mit der google maps api. Ich habe mir einen api-key besorgt und versuche nun einfach eine map anzuzeigen. dazu habe ich folgenden code geschrieben:
Der Code kompiliert ohne Warnung und Error, aber die Karte wird nicht angezeigt. Was mache ich falsch hier?
Danke
Jo
ich bin neu beim programmieren in Android und habe ein Problem mit der google maps api. Ich habe mir einen api-key besorgt und versuche nun einfach eine map anzuzeigen. dazu habe ich folgenden code geschrieben:
Code:
package com.example.radiationmap;
------ Startup activity ----
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class RadiationMap extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_radiation_map);
}
}
Code:
------ Manifest
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="INSERTEDMYAPIKEYHERE"/>
<permission android:name="com.example.radiationmap.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
<uses-permission android:name="com.example.radiationmap.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.radiationmap.RadiationMap"
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>
---- activity_radiation_map.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="INSERTEDAPIKEYHERE"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world" />
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
Der Code kompiliert ohne Warnung und Error, aber die Karte wird nicht angezeigt. Was mache ich falsch hier?
Danke
Jo
Zuletzt bearbeitet von einem Moderator: