I’ve been trying to follow this tutorial on using Google Map View in Android. In the second part, they create an mContext member variable and then pass that into AlertDialog.Builder(mContext), but the constructor that they call to create an instance of an HelloItemizedOverlay doesn’t instantiate mContext, so it’s just left null as far as I know.
The program doesn’t work properly, and throws a NullPointerException as I suspected. How is this supposed to work?
Thanks,
Jengerer
In the tutorial, step 2 (the onCreate section) they instantiate a HelloItemizedOverlay:
But notice that in the HelloItemizedOverlay constructor, it takes a Drawable and Context:
So the fault is with the tutorial. They’re instantiating the class without a Context object, making it null. In your onCreate() method, just add
thisto the constructor.