Skip to content

Instantly share code, notes, and snippets.

Last active August 26, 2015 10:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save progzilla/b279b625599dace0453d to your computer and use it in GitHub Desktop.
Android MapView NullPointerException
public class MainMapView extends FrameLayout {
@InjectView( MapView mapView;
public MainMapView(Context context, AttributeSet attrs) {
super(context, attrs);
private void init() {
inflate(getContext(), R.layout.discount_map_content, this);
public void onCreate(Bundle savedInstanceState) {
// Gets to GoogleMap from the MapView and does initialization stuff
// Needs to call MapsInitializer before doing any CameraUpdateFactory calls
// Updates the location and zoom of the MapView
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(Position.getCurrent(getContext()).toLatLng(), 14);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment