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

  • Home
  • SEARCH
  • 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 6152975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:00:52+00:00 2026-05-23T20:00:52+00:00

@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.map); MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true);

  • 0
    @Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.map);
    MapView mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);
    badplatsName = getIntent().getStringExtra("se.brickit.badplatsen.badplatsname");
    lat = getIntent().getIntExtra("se.brickit.badplatsen.lat",0);
    lon = getIntent().getIntExtra("se.brickit.badplatsen.lon",0);

    List<Overlay> mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.smiley_flask);
    BrMapViewItemOverlay itemizedoverlay = new BrMapViewItemOverlay(drawable);
    GeoPoint point = new GeoPoint(lat,lon);
    OverlayItem overlayitem = new OverlayItem(point, badplatsName, "");
    itemizedoverlay.addOverlay(overlayitem);
    mapOverlays.add(itemizedoverlay);
    mapView.getController().animateTo(point);
    mapView.getController().zoomToSpan(6, 6);
    mapView.setSatellite(true);
}

When i click on the overlay item the application crashes. anybody know the reason why?

the logcat is a bit odd too as it appears to be trying to launch an activity but all i want it to do is show a box with the name when clicked.

07-20 14:36:56.303: ERROR/AndroidRuntime(15856): FATAL EXCEPTION: main
07-20 14:36:56.303: ERROR/AndroidRuntime(15856): java.lang.NullPointerException
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.android.internal.app.AlertController$AlertParams.<init>(AlertController.java:743)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.app.AlertDialog$Builder.<init>(AlertDialog.java:273)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at se.brickit.badplatsen.BrMapViewItemOverlay.onTap(BrMapViewItemOverlay.java:43)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.google.android.maps.ItemizedOverlay.onTap(ItemizedOverlay.java:453)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.google.android.maps.OverlayBundle.onTap(OverlayBundle.java:83)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.google.android.maps.MapView$1.onSingleTapUp(MapView.java:347)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.google.android.maps.GestureDetector.onTouchEvent(GestureDetector.java:533)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.google.android.maps.MapView.onTouchEvent(MapView.java:647)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.view.View.dispatchTouchEvent(View.java:3765)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:905)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:944)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:944)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:944)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1701)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1116)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.app.Activity.dispatchTouchEvent(Activity.java:2093)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1685)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1802)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.os.Looper.loop(Looper.java:144)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at android.app.ActivityThread.main(ActivityThread.java:4937)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at java.lang.reflect.Method.invokeNative(Native Method)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at java.lang.reflect.Method.invoke(Method.java:521)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-20 14:36:56.303: ERROR/AndroidRuntime(15856):     at dalvik.system.NativeStart.main(Native Method)
07-20 14:36:58.163: ERROR/ActivityManager(96): fail to set top app changed!
07-20 14:36:58.243: ERROR/AndroidRuntime(15896): FATAL EXCEPTION: main
07-20 14:36:58.243: ERROR/AndroidRuntime(15896): java.lang.RuntimeException: Unable to start activity ComponentInfo{se.brickit.badplatsen/se.brickit.badplatsen.Tabs}: android.content.res.Resources$NotFoundException: Resource ID #0x0
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.os.Looper.loop(Looper.java:144)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.app.ActivityThread.main(ActivityThread.java:4937)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at java.lang.reflect.Method.invokeNative(Native Method)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at java.lang.reflect.Method.invoke(Method.java:521)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at dalvik.system.NativeStart.main(Native Method)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.content.res.Resources.getValue(Resources.java:892)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.content.res.Resources.getDrawable(Resources.java:580)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at se.brickit.badplatsen.Tabs.onCreate(Tabs.java:192)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
07-20 14:36:58.243: ERROR/AndroidRuntime(15896):     ... 11 more
07-20 14:37:00.053: ERROR/ClockWidget(209): weatherClock onReceive~ mUseAnimation:false
07-20 14:37:00.053: ERROR/ClockWidget(209): weatherClock onReceive~ mUseAnimation:false

Ps here is the overlay class:

public class BrMapViewItemOverlay extends ItemizedOverlay {
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
private Context mContext;

public BrMapViewItemOverlay(Drawable defaultMarker) {
    super(boundCenterBottom(defaultMarker));
}

public BrMapViewItemOverlay(Drawable defaultMarker, Context context) {
    super(defaultMarker);
    mContext = context;
}

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

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

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

@Override
protected boolean onTap(int index) {
    OverlayItem item = mOverlays.get(index);
    AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
    dialog.setTitle(item.getTitle());
    dialog.setMessage(item.getSnippet());
    dialog.show();
    return true;
}

}

  • 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-23T20:00:53+00:00Added an answer on May 23, 2026 at 8:00 pm

    Replace this line

    BrMapViewItemOverlay itemizedoverlay = new BrMapViewItemOverlay(drawable);

    with

     BrMapViewItemOverlay itemizedoverlay = new BrMapViewItemOverlay(drawable, this);
    

    You have not passed the context and hence inflating AlertDialog is causing failure.

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

Sidebar

Related Questions

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.picture_choice_activity); Button takePictureButton = (Button)findViewById(R.id.takePictureButton); takePictureButton.setOnClickListener(new OnClickListener()
This is my ListActivity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_list); mDbHelper =
String[] items = new String[10]; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Main(); }
public class SettingsActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /*
Here's the code: public class MenuTabActivity extends TabActivity implements OnTabChangeListener{ @Override protected void onCreate(Bundle
public class Browser1Activity extends Activity { TextView url; WebView ourBrow; @Override protected void onCreate(Bundle
i found this code: protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource hwndSource =
i have the following method in a usercontrol protected override void Render(HtmlTextWriter writer) {
In my code behind I wire up my events like so: protected override void

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.