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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:14:22+00:00 2026-06-02T03:14:22+00:00

I’m using the mapviewballoons from github and it is working up to the point

  • 0

I’m using the mapviewballoons from github and it is working up to the point where I’m trying to open another activity from a ballonItemizedOverlay

    private ArrayList<OverlayItem> m_overlays = new ArrayList<OverlayItem>();
private Context c;


public mlgwItemizedOverlay(Drawable defaultMarker,  MapView mapView) {
    super(boundCenter(defaultMarker), mapView);
    c = mapView.getContext();
}

public void addOverlay(OverlayItem overlay) {
    m_overlays.add(overlay);
    populate();
}

@Override
protected OverlayItem createItem(int i) {
    return m_overlays.get(i);
}

@Override
public int size() {
    return m_overlays.size();
}


@Override
protected boolean onBalloonTap(int index, OverlayItem item) {
    Intent Details = new Intent(c, BlogActivity.class); 
    //Details.putExtra("Id", 1327); 
    c.startActivity(Details); 
    return true;
} 

}

Here is my Main Activity

    TapControlledMapView mapView; // use the custom TapControlledMapView
List<Overlay> mapOverlays;
Drawable drawable;
mlgwItemizedOverlay itemizedOverlay;
mlgwItemizedOverlay itemizedOverlay2;

private static final class LatLonPoints extends GeoPoint { 
    public LatLonPoints(double latitude, double longitude) { 
        super((int) (latitude * 1E6), (int) (longitude * 1E6)); 
    } 
} 
@Override
public void onCreate(Bundle savedInstanceState) {

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


    mapView = (TapControlledMapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    // dismiss balloon upon single tap of MapView (iOS behavior) 
    mapView.setOnSingleTapListener(new OnSingleTapListener() {      
        @Override
        public boolean onSingleTap(MotionEvent e) {
            itemizedOverlay.hideAllBalloons();
            return true;
        }
    });

    mapOverlays = mapView.getOverlays();

    // first overlay
    drawable = getResources().getDrawable(R.drawable.marker);
    itemizedOverlay = new mlgwItemizedOverlay(drawable,  mapView);
    // set iOS behavior attributes for overlay
    itemizedOverlay.setShowClose(false);
    itemizedOverlay.setShowDisclosure(true);
    itemizedOverlay.setSnapToCenter(false);

     GeoPoint StartPoint = new LatLonPoints(35.149534,-90.04898);   
        // first overlay

    GeoPoint point = new LatLonPoints(35.139646,-90.05521);

    OverlayItem overlayItem = new OverlayItem(point, "Hello", "I'm am the first location");                     
    itemizedOverlay.addOverlay(overlayItem);
    mapOverlays.add(itemizedOverlay);

    GeoPoint point2 = new LatLonPoints(35.020922,-90.027045);
    OverlayItem overlayItem2 = new OverlayItem(point2, "Hello", "I'm am the second location"); 
    itemizedOverlay.addOverlay(overlayItem2);
    mapOverlays.add(itemizedOverlay);

    GeoPoint point3 = new LatLonPoints(35.151009,-89.978281);
    OverlayItem overlayItem3 = new OverlayItem(point3, "Hello", "I'm am the third location");       
    itemizedOverlay.addOverlay(overlayItem3);
    mapOverlays.add(itemizedOverlay);

    GeoPoint point4 = new LatLonPoints(35.088971,-89.965608);
    OverlayItem overlayItem4 = new OverlayItem(point4,  "Hello", "I'm am the fourth location");         
    itemizedOverlay.addOverlay(overlayItem4);       
    mapOverlays.add(itemizedOverlay);

    GeoPoint point5 = new LatLonPoints(35.341282,-89.8922298);
    OverlayItem overlayItem5 = new OverlayItem(point5,  "Hello", "I'm am the fifth location");      
    itemizedOverlay.addOverlay(overlayItem5);       
    mapOverlays.add(itemizedOverlay);

    if (savedInstanceState == null) {

        final MapController mc = mapView.getController();
        mc.animateTo(StartPoint);
        mc.setZoom(11);

    } else {

        // example restoring focused state of overlays
        int focused;
        focused = savedInstanceState.getInt("focused_1", -1);
        if (focused >= 0) {
            itemizedOverlay.setFocus(itemizedOverlay.getItem(focused));
        }
        focused = savedInstanceState.getInt("focused_2", -1);
        if (focused >= 0) {
            itemizedOverlay2.setFocus(itemizedOverlay2.getItem(focused));
        }

    }

}
  public void startCustomActivity(){ 
      Intent Details = new Intent(getBaseContext(), BlogActivity.class); 
      Details.putExtra("Id", 1327); 
      startActivity(Details); 
  } 

@Override
protected boolean isRouteDisplayed() {
    return false;
}

@Override
protected void onSaveInstanceState(Bundle outState) {

    // example saving focused state of overlays
    if (itemizedOverlay.getFocus() != null) outState.putInt("focused_1", itemizedOverlay.getLastFocusedIndex());
    if (itemizedOverlay2.getFocus() != null) outState.putInt("focused_2", itemizedOverlay2.getLastFocusedIndex());
    super.onSaveInstanceState(outState);

}

}

and here is blog activity that I trying to open

public class BlogActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView textview = new TextView(this);
    textview.setText("This is the Blog tab");
    setContentView(textview);
}

}

Once I press the overlay the app crashes and the errors that are being returned are:

04-18 04:39:56.465: E/MapActivity(8938): Couldn't get connection factory client
04-18 04:40:03.075: E/AndroidRuntime(8938): FATAL EXCEPTION: main
04-18 04:40:03.075: E/AndroidRuntime(8938): java.lang.RuntimeException: Unable to pause activity {com.mlgw.MlgwMapView/com.mlgw.MlgwMapView.MlgwMapViewActivity}: java.lang.NullPointerException
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2354)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2311)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2291)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.ActivityThread.access$1700(ActivityThread.java:117)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:938)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.os.Handler.dispatchMessage(Handler.java:99)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.os.Looper.loop(Looper.java:130)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-18 04:40:03.075: E/AndroidRuntime(8938): at java.lang.reflect.Method.invokeNative(Native Method)
04-18 04:40:03.075: E/AndroidRuntime(8938): at java.lang.reflect.Method.invoke(Method.java:507)
04-18 04:40:03.075: E/AndroidRuntime(8938): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-18 04:40:03.075: E/AndroidRuntime(8938): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-18 04:40:03.075: E/AndroidRuntime(8938): at dalvik.system.NativeStart.main(Native Method)
04-18 04:40:03.075: E/AndroidRuntime(8938): Caused by: java.lang.NullPointerException
04-18 04:40:03.075: E/AndroidRuntime(8938): at com.mlgw.MlgwMapView.MlgwMapViewActivity.onSaveInstanceState(MlgwMapViewActivity.java:131)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.Activity.performSaveInstanceState(Activity.java:1037)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1181)
04-18 04:40:03.075: E/AndroidRuntime(8938): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2336)
04-18 04:40:03.075: E/AndroidRuntime(8938): ... 12 more

My main goal is to pass more data about the annotation that they click on to the new activity.

Can you tell me what I’m doing wrong or point me to the right solution. I’ve searched google for other answers but I haven’t found any that 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-06-02T03:14:24+00:00Added an answer on June 2, 2026 at 3:14 am

    Your issue is that you are over-riding onSaveInstanceState but not calling the superclass method: do this.

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    
        // example saving focused state of overlays
        if (itemizedOverlay.getFocus() != null) outState.putInt("focused_1", itemizedOverlay.getLastFocusedIndex());
        if (itemizedOverlay2.getFocus() != null) outState.putInt("focused_2", itemizedOverlay2.getLastFocusedIndex());
        super.onSaveInstanceState(outState);
    
    }
    

    See if that helps.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am trying to render a haml file in a javascript response like so:

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.