Tag: fragment

我如何访问片段中的getSupportFragmentManager()?

我有一个FragmentActivity,我想使用它内的地图片段。 我有一个问题让支持片段管理器来访问它。 if (googleMap == null) { googleMap = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map1)).getMap(); // check if map is created successfully or not if (googleMap == null) { Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); } } // create marker MarkerOptions marker = new MarkerOptions().position( new LatLng(latitude, longitude)).title("Hello Maps "); CameraPosition cameraPosition = new CameraPosition.Builder() .target(new […]