Проблемы MapView / Пустые плитки - PullRequest
0 голосов
/ 26 февраля 2012

У меня проблемы с MapView. Я использовал MapView раньше, так что я действительно не знаю, в чем проблема, вероятно, я упускаю из виду нечто простое, но это сводит меня с ума.Приложение устанавливается и работает весело, но плитки MapView не загружаются.Я вижу только пустую сетку.Я знаю, что ключ API (хранилище ключей отладки) забавен, потому что у меня есть другой проект, использующий его, который работает отлично.Я включил файлы манифеста, макета и действий, чтобы помочь диагностировать проблему.Буду признателен за любую помощь - я озадачен!

манифест:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.***.studybuddy"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET"/>

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar" >
    <uses-library android:name="com.google.android.maps" />
    <activity
        android:name=".StudyBuddy"
        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=".MapInterface" >
    </activity>
    <service
        android:name=".FriendService" >
        <intent-filter>
            <action
                android:name="com.***.studybuddy.FriendService" />
        </intent-filter>
    </service>
</application>

макет:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <LinearLayout
        android:id="@+id/sideMenuInterface"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#FFFFFF" >
    </LinearLayout>
    <LinearLayout
        android:id="@+id/mapInterface"
        android:layout_alignLeft="@id/sideMenuInterface"
        android:layout_alignTop="@id/sideMenuInterface"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        <RelativeLayout
            android:id="@+id/topMenu"
            android:layout_width="fill_parent"
            android:layout_height="30dp"
            android:clickable="true"
            android:onClick="onClick" >
        </RelativeLayout>
        <com.google.android.maps.MapView
            android:id="@+id/mapView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:clickable="true"
            android:apiKey="0f6nuBOcz_OlhAQm3B3Xljy5hDOVrR1FO3KM***"
        />
    </LinearLayout>
</RelativeLayout>

активность:

package com.***.studybuddy;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class MapInterface extends MapActivity implements OnClickListener {
    static int USER_ID = 1;
    static MapView mapView;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapinterface);

        configure();
    }

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

    private void configure() {
        findViews();
        startService(new Intent(FriendService.class.getName()));
        mapView.setBuiltInZoomControls(true);
        mapView.setSatellite(true);
    }

    private void findViews() {
        mapView = (MapView) findViewById(R.id.mapView);
    }

    @Override
    public void onClick(View view) {
        switch(view.getId()) {
        case R.id.topMenu:
            ((View)view.getParent()).setVisibility(View.GONE);
            break;
        }

    }
}

Снимок экрана: Empty Tiles

1 Ответ

0 голосов
/ 26 февраля 2012

Однажды у меня была проблема, что я пропустил некоторые разрешения.Мне нужны эти 3 разрешения (вам не хватает первых двух из них.):

<uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION”></uses-permission>
<uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION”></uses-permission>
<uses-permission android:name=”android.permission.INTERNET”></uses-permission>
...