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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:34:52+00:00 2026-05-28T03:34:52+00:00

I was trying to modify the HelloGoogleMaps tutorial so i can populate a list

  • 0

I was trying to modify the HelloGoogleMaps tutorial so i can populate a list using a for loop rather than by individually typing them out. Taking baby steps, i tried just adding one point but i get a null pointer exception when i call the add method of the GeoPoint list. thanks.

    import java.util.List;
    import com.google.android.maps.GeoPoint;
    //import com.google.android.maps.ItemizedOverlay;
    import com.google.android.maps.MapActivity;
    import com.google.android.maps.MapView;
    import com.google.android.maps.Overlay;
    import com.google.android.maps.OverlayItem;

    import android.graphics.drawable.Drawable;

    import android.os.Bundle;        
public class HelloGoogleMaps extends MapActivity {
/** Called when the activity is first created. */

public List<GeoPoint> geoPoints;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    //allows zooming
    MapView mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);



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

    //create adding points
   GeoPoint point1 = new GeoPoint(19240000,-99120000);
  geoPoints.add(point1);//<<<<<<-------this is where i get the exception

//eventual for loop goes here
}



@Override
protected boolean isRouteDisplayed() {
    return false;
}
 }//end Map Activity
  • 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-28T03:34:53+00:00Added an answer on May 28, 2026 at 3:34 am

    You need to initialize the list:

    private List<GeoPoint> geoPoints = new ArrayList<GeoPoint>();
    // And also make it private...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to modify the various loaders out there so multiple scripts can be
I'm currently trying to modify some HttpWebRequest functions, but I can't do it through
I'm trying to modify the contents of an MSI file using Powershell. To do
i've been trying to modify the program so that it could accept more than
I am trying to modify a value in an array using the C programming
I am trying to modify a Makefile, and I can't find the rule for
I am trying to modify the tutorial Ray Wenderlich has created at: http://www.raywenderlich.com/1888/how-to-create-a-simple-iphone-app-tutorial-part-33 So
I am trying to modify a list and since my modifications were getting a
I am trying to modify the design of Spinner widget. I can change the
I'm trying to modify the contents of one pointer using another. I want string2

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.