Skip to content

Instantly share code, notes, and snippets.

@FilHazer
Last active January 14, 2016 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FilHazer/ebc13a5e9601ff369999 to your computer and use it in GitHub Desktop.
Save FilHazer/ebc13a5e9601ff369999 to your computer and use it in GitHub Desktop.
MapFragment
public class MapFragment extends Fragment {
MapView mapView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.map, container, false);
//initialize map
mapView = (MapView) rootView.findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
Log.i("DEBUG", "onMapReady");
}
});
return rootView;
}
@Override
public void onResume() {
mapView.onResume();
super.onResume();
}
@Override
public void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment