Skip to content

Instantly share code, notes, and snippets.

@theblang
Created November 17, 2014 16:03
Show Gist options
  • Save theblang/d5bf6d1862dd6678fce1 to your computer and use it in GitHub Desktop.
Save theblang/d5bf6d1862dd6678fce1 to your computer and use it in GitHub Desktop.
SupportMapFragment loads slowly the first time
private SupportMapFragment supportMapFragment;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_map, container, false);
supportMapFragment = SupportMapFragment.newInstance();
getChildFragmentManager().beginTransaction().replace(R.id.map_container, supportMapFragment).commit();
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onStart() {
super.onStart();
final GoogleMap googleMap = supportMapFragment.getMap();
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment