Thursday, 12 September 2013

MapFragment manager error in sub class of app

MapFragment manager error in sub class of app

I am trying to make a class that deals with the various googleMap realated
functions and tasks.
This includes setting up the map itself, handling markers etc.
My problem is... the code I have works fine if its all in the same file as
my main activity, however the following does not work when I move it into
a separate class.
UPDATE
public class Mapper extends Activity {
GoogleMap googleMap;
public Mapper(Context context) {
this.context = context;
getMap();
}
private void getMap() {
googleMap =
((MapFragment)getFragmentManager().findFragmentById(R.id.googleMap)).getMap();
}
}
I get the following error:
http://puu.sh/4pLxT.png
I am really unsure as to why it works in the main class but not this one.
Any help would be amazing!

No comments:

Post a Comment