I'm getting a NullPointerException
in the onCreateView
method of my fragment but what is strange is that this only occurrs on the emulator. On the device the app runs fine.
If I set a breakpoint for NullPointerException and debug in eclipse it stops at this line:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_map, container, false);
mapTrackButton = (Button) rootView.findViewById(R.id.track_user_button);
map = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.setMyLocationEnabled(true); // This line
// More code
}