2

Ok, so I just begun with Android Development and basically my issue is what title describes. What I tried until now is to create a default Drawer Navigation Activity project and "grab" the default code produced from a Google Maps Activity project and try to inject it inside the Drawer Navigation project.

The reason I want this to work is because Drawer Nav Activity looks nice and it would be nice to have google maps in the main screen of it.

I tried various stuff and I tried playing with it a lot, but always I end up with an error or the App Force Closing. One of the ways that I tried to make this happen, is by creating an intent and calling the map activity class inside the OnCreate() function of Drawer Class, but I keep receiving a Null Pointer error.

So, I can post the current code if you need it, but I would like first to hear opinions about a good way to implement the above idea.

Well, if someone could provide with a simple working example, this would definitely be awesome.

~ Thank you all, any comment/opinion/suggestion is warmly welcome.

P.S: The main error that I've been struggling with is:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.s0me0n3.ytgooglemapstut/com.example.s0me0n3.ytgooglemapstut.MyActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.UiSettings com.google.android.gms.maps.GoogleMap.getUiSettings()' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
            at android.app.ActivityThread.access$800(ActivityThread.java:143)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5070)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.UiSettings com.google.android.gms.maps.GoogleMap.getUiSettings()' on a null object reference
            at com.example.s0me0n3.ytgooglemapstut.MyActivity$PlaceholderFragment.onCreateView(MyActivity.java:148)
            at android.app.Fragment.performCreateView(Fragment.java:1704)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1063)
            at android.app.BackStackRecord.run(BackStackRecord.java:684)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1448)
            at android.app.Activity.performStart(Activity.java:5735)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
            at android.app.ActivityThread.access$800(ActivityThread.java:143)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5070)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)

0 Answers0