How do I add a maps activity to HomeFragment in Nav Drawer activity, so that the map works in android studio

64 Views Asked by At

Hi I'm trying to create a simple app with google maps on the home page and a navigational drawer on top. Before I added functionality to the map activity so that the user's location blue dot appears on the map and the camera zooms in on it automatically.

I created a navigation drawer activity within the same app and included the activity_maps.xml layout into a frame in the HomeFragment layout.

The map displayed as intended, but the camera no longer zooms in and the blue dot doesn't appear anymore, what am I missing for the functionality to work in a fragment?

1

There are 1 best solutions below

0
Birkhami On

Ok I found a tutorial that helped. It's on youtube, it's called "Latest Android App Development: Google Map in Fragment in Navigation Drawer, SupportMapFragment" by Oum Saokosal and it did pretty much what I needed to do. The main point of it is that you have to do all the functionalities in the fragment activity .java file that I did in MapsActivity.java