小编kev*_*998的帖子

Google地图未显示Android

我想在我的应用程序中实现google maps。我添加了一个Google Maps活动并创建了一个密钥。我没有在其他地方更改代码中的任何内容。我应该工作,但是不可以。

MapsActivity

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}


/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move …
Run Code Online (Sandbox Code Playgroud)

java android google-maps google-maps-android-api-2

0
推荐指数
1
解决办法
9443
查看次数