Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8955171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:29:19+00:00 2026-06-15T14:29:19+00:00

I am trying to use the new Google Play Services Lib and embbed Maps

  • 0

I am trying to use the new Google Play Services Lib and embbed Maps in side the Maps Fragment as below

PlaceMapsFragment.java

public class PlaceMapsFragment extends SupportMapFragment {
    private GoogleMap mMap;
    private LatLng mPosFija;

    public PlaceMapsFragment() {
        super();
    }

    public static PlaceMapsFragment newInstance(LatLng posicion) {
        PlaceMapsFragment frag = new PlaceMapsFragment();
        frag.mPosFija = posicion;
        return frag;
    }

    @Override
    public GoogleMap getMap() {
        // TODO Auto-generated method stub
        return super.getMap();
    }

    @Override
    public void onCreate(Bundle arg0) {
        // TODO Auto-generated method stub
        super.onCreate(arg0);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        //initMap();
        return view;
    }

    private void initMap() {
        UiSettings settings = getMap().getUiSettings();
        settings.setAllGesturesEnabled(false);
        settings.setMyLocationButtonEnabled(false);

        getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(mPosFija, 16));
        getMap().addMarker(
                new MarkerOptions().position(mPosFija)
                        .icon(BitmapDescriptorFactory
                                .fromResource(R.drawable.marker)));
    }

}

Error

12-10 01:44:54.416: E/AndroidRuntime(32716): FATAL EXCEPTION: main
12-10 01:44:54.416: E/AndroidRuntime(32716): java.lang.NullPointerException
12-10 01:44:54.416: E/AndroidRuntime(32716):    at maps.ar.b.a(Unknown Source)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at maps.y.h.a(Unknown Source)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at maps.y.au.a(Unknown Source)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at maps.y.ae.moveCamera(Unknown Source)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.google.android.gms.maps.internal.IGoogleMapDelegate$Stub.onTransact(IGoogleMapDelegate.java:83)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.os.Binder.transact(Binder.java:297)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.moveCamera(Unknown Source)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.google.android.gms.maps.GoogleMap.moveCamera(Unknown Source)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.m7.nomad.PlaceMapsFragment.initMap(PlaceMapsFragment.java:55)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.m7.nomad.PlaceMapsFragment.onCreateView(PlaceMapsFragment.java:46)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.m7.nomad.PlaceActivity$TabManager.onTabChanged(PlaceActivity.java:153)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.widget.TabHost.invokeOnTabChangeListener(TabHost.java:379)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.widget.TabHost.setCurrentTab(TabHost.java:364)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:150)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:540)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.view.View.performClick(View.java:3591)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.view.View$PerformClick.run(View.java:14263)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.os.Handler.handleCallback(Handler.java:605)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.os.Looper.loop(Looper.java:137)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at android.app.ActivityThread.main(ActivityThread.java:4507)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at java.lang.reflect.Method.invokeNative(Native Method)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at java.lang.reflect.Method.invoke(Method.java:511)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
12-10 01:44:54.416: E/AndroidRuntime(32716):    at dalvik.system.NativeStart.main(Native Method)

enter image description here

Manifest File

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.m7.nomad"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <permission
        android:name="com.example.newmapview.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.newmapview.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Sherlock" >
        <activity
            android:name="com.m7.nomad.SplashActivity"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="com.m7.nomad.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.m7.nomad.PlaceActivity"
            android:label="@string/app_name" >
        </activity>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="XXXXXXXXXXX" />
    </application>

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

</manifest>

I have a SherlockFragmentActivity which has a TabHost which has two Fragments attached to it. I am trying to render the map inside one of those Tab Fragments

Edit

I have got the Map to be Displayed but now i am not able to Reference the Map and Change the Map to Hybrid. Basically i need to Reference the Map with out getting the Null error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:29:21+00:00Added an answer on June 15, 2026 at 2:29 pm

    In onCreateView() you must call its parent. Check my solution in https://stackoverflow.com/a/13734470/835787 closer. The map is initialized in the onCreateView() method of MapFragment, if you don’t call it the map will be null.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the new google maps android api v2 and i'm developing
I am trying to use new Google Cloud Messaging system but I have some
I'trying to use Google APIs Client Library for Java to get information about user's
I'm trying to use the MVC objects in Google Maps version 3. What I
I am trying to test the new subscriptions in Google Play but the service
I'm experiencing a problem while trying to use google maps api v3 (with marker
GOOGLE MAPS API V3 is what i'm trying to use. I have all the
I am trying to use the google maps javascript API to map an address
Thank you in advance for all your help. I'm trying to use google maps
I am trying to use the geocoding service with the google maps to display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.