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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:03:40+00:00 2026-06-07T01:03:40+00:00

I’m creating a mapView activity and for some reason this code isn’t working: @Override

  • 0

I’m creating a mapView activity and for some reason this code isn’t working:

@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.map_view);
    MapView mapView = (MapView)this.findViewById(R.layout.map_view);
    MapController mapController = mapView.getController();

This line specifically is causing the app to crash:

MapController mapController = mapView.getController();

When I take that line out, the app works like it should, but when I put it in, it crashes when I start the activity, with the error message:

07-05 21:27:24.857: E/AndroidRuntime(23801): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.uie.top25.seattle/com.uie.top25.seattle.MapDetailActivity}: java.lang.NullPointerException

Here is my call to the mapView:

@Override
protected void onCreate(Bundle savedInstanceState)
{

    super.onCreate(savedInstanceState);

    this.setContentView(R.layout.detail);
    Bundle bundle = this.getIntent().getExtras();
    ListData listdata = bundle.getParcelable("uie.top25.seattle.listdata");

    // int itemId = this.getIntent().getIntExtra(DiningActivity.ITEM_ID, -1);
    String itemTitle = listdata.getTitle();
    int itemNum = listdata.getItem();
    String sHead = listdata.getSubhead();
    String dText = listdata.getDetailText();
    final float latitude = listdata.getLatitude();
    final float longitude = listdata.getLongitude();
    Log.i(TAG, "Title that is set : " + itemTitle);
    Log.i(TAG, "Item Number that is set : " + itemNum);
    Log.i(TAG, "Latitude that is set : " + latitude);
    Log.i(TAG, "Longitude that is set : " + longitude);
    if (itemNum >= 0)
    {

        TextView tView = (TextView) this.findViewById(R.id.textTitle);
        tView.setText(itemTitle);
        TextView nView = (TextView) this.findViewById(R.id.itemNumber);
        nView.setText("" + itemNum);
        TextView subHead = (TextView) this.findViewById(R.id.textSubheader);
        subHead.setText(sHead);
        TextView details = (TextView) this.findViewById(R.id.itemDescription);
        details.setText(dText);
        ImageButton mapButton = (ImageButton) this.findViewById(R.id.mapButton);
            mapButton.setOnClickListener(new View.OnClickListener() {
                             //this is where I call my mapView from
                @Override
                public void onClick(View v)
                {
                    Intent mapIntent = new Intent(DetailActivity.this, MapDetailActivity.class);
                    //mapIntent.putExtra("uie.top25.seattle.listlat", latitude);
                    //mapIntent.putExtra("uie.top25.seattle.longitude", longitude);

                    startActivity(mapIntent);

                }
            });
    }
}

}

Can anyone give me some direction as to what I’m doing wrong?

  • 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-07T01:03:41+00:00Added an answer on June 7, 2026 at 1:03 am

    Can you try replacing this line:

     MapView mapView = (MapView)this.findViewById(R.layout.map_view);
    

    with this one:

     MapView mapView = (MapView)this.findViewById(R.id.<your mapView Id>);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

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.