Questions tagged «fragmentmanager»

18
如何在片段中访问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 …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.