2

告诉我,为什么不起作用?给予每一秒。并显示一个空白单元格。

在此处输入图像描述

设置“AndroidManifest”应该没问题,因为工作前几个小时。

ActivityThread Failed to find provider info for com.google.android.gsf.gservices

几个小时前,一切正常,没有任何改变。

public class TravelMapActivity extends FragmentActivity {

    private GPSTrackerService gpsService;

    private SupportMapFragment mMapFragment;
    private GoogleMap googleMap;

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

        SupportMapFragment supportMapFragment = (SupportMapFragment)
                getSupportFragmentManager().findFragmentById(R.id.map);
                googleMap = supportMapFragment.getMap();

//This option does not work either.

//      mMapFragment = new SupportMapFragment();
//      try {
//          MapsInitializer.initialize(this);
//      } catch (GooglePlayServicesNotAvailableException e) {
//          // TODO handle error
//          e.printStackTrace();
//      }
//      getSupportFragmentManager().beginTransaction().add(android.R.id.content, mMapFragment).commit();

    }

xml

<?xml version="1.0" encoding="utf-8"?>
<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" >

    <ToggleButton
        android:id="@+id/toggleButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ToggleButton" />

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
4

0 回答 0