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 7413993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:59:10+00:00 2026-05-29T06:59:10+00:00

I’ve tried every example i could google, and every solution i could find on

  • 0

I’ve tried every example i could google, and every solution i could find on both stackoverflow and other sites.. But this i just cant get to work..

Now im using the example from androids own website where i create a seperate class. This is my code:

        super.onCreate(savedInstanceState);
    setContentView(R.layout.win_showmap) ;

    MapView map = (MapView) findViewById(R.id.googlemap) ;
    map.setBuiltInZoomControls(true);
    mapController = map.getController() ;
    mapController.setZoom(12);

    int lat = (int)(Double.parseDouble(GlobalClass.pass_lattitude) * 1000000) ;
    int lon = (int)( Double.parseDouble(GlobalClass.pass_longitude) * 1000000);
    GeoPoint point = new GeoPoint(lat,lon) ;
    p = point ;
    mapController.animateTo(point) ;
    //---Add a location marker---

    List<Overlay> mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.pushpin);
    Mapoverlays itemizedoverlay = new Mapoverlays(drawable);


    OverlayItem overlayitem = new OverlayItem(point, "Hola, Mundo!", "I'm in Mexico City!");

    itemizedoverlay.addOverlay(overlayitem);
    mapOverlays.add(itemizedoverlay);

By using Log.d i can find the crash point that gives null point error, to be the line:
List mapOverlays = mapView.getOverlays();

My API key works fine, because i can se the map if i remove the 6 lines of mapoverlay code.
Don’t know if it means anything, but i get these Logcats when not having the overlay code.

02-03 22:44:05.892: I/MapActivity(2374): Handling network change notification:CONNECTED
02-03 22:44:05.892: E/MapActivity(2374): Couldn’t get connection factory client

And if i include the overlay code it crashes and i get the Logcat:
02-03 22:45:33.183: E/AndroidRuntime(2465): FATAL EXCEPTION: main
02-03 22:45:33.183: E/AndroidRuntime(2465): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.closebuy.namespace/com.closebuy.namespace.Show_map}: java.lang.NullPointerException
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.os.Looper.loop(Looper.java:123)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-03 22:45:33.183: E/AndroidRuntime(2465): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 22:45:33.183: E/AndroidRuntime(2465): at java.lang.reflect.Method.invoke(Method.java:521)
02-03 22:45:33.183: E/AndroidRuntime(2465): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-03 22:45:33.183: E/AndroidRuntime(2465): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-03 22:45:33.183: E/AndroidRuntime(2465): at dalvik.system.NativeStart.main(Native Method)
02-03 22:45:33.183: E/AndroidRuntime(2465): Caused by: java.lang.NullPointerException
02-03 22:45:33.183: E/AndroidRuntime(2465): at com.closebuy.namespace.Show_map.onCreate(Show_map.java:48)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-03 22:45:33.183: E/AndroidRuntime(2465): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

I’ve tried it on emulator and on my Galaxy S2.. Please help, i really wan’t this to work

  • 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-05-29T06:59:11+00:00Added an answer on May 29, 2026 at 6:59 am

    By using Log.d i can find the crash point that gives null point error, to be the line: List mapOverlays = mapView.getOverlays();

    Where are you declaring and initializing the variable mapView? The only MapView type variable I see initialized is map.

    MapView map = (MapView) findViewById(R.id.googlemap) ;
    

    So, I would try:

    List<Overlay> mapOverlays = map.getOverlays();
    

    If that still crashes with a null pointer error, then you have no MapView view declared within the win_showmap.xml layout.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.