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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:38:40+00:00 2026-05-25T13:38:40+00:00

So I am trying to create a program that tracks gps coordinates and then

  • 0

So I am trying to create a program that tracks gps coordinates and then display them real time in a list view on the side of my main screen, the layout looks as follows:

_______
|{} |LV|
|   |  |
|   |  |
|   |  |
|___|__|

{} = button
LV = list view scrolling vertical

What I have in on create is:

    public void onCreate(Bundle bundleIn) {
        super.onCreate(bundleIn);

        setContentView(R.layout.main);
        retrieveLocationButton = (Button)findViewById(R.id.retrieve_location_button);
        bottomList = (ListView)findViewById(R.id.myListView);
        AllLocals.add("1");
        bottomList.setAdapter(new ArrayAdapter<String>(this.getApplicationContext(), R.id.simple_text, AllLocals));

        //viewCollectedData = (Button)findViewById(R.id.view_lat_lon_data);

        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        //setListAdapter(new ArrayAdapter<Location>(this,android.R.layout.simple_list_item_1,AllLocals));

XML file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_weight="1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_weight="1" 
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent">

            <Button android:layout_height="wrap_content" 
            android:text="Get Local" 
            android:id="@+id/retrieve_location_button" 
            android:layout_width="wrap_content">
            </Button>

    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1">
          <TextView android:id="@+id/simple_text"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
          />
          <ListView android:id="@+id/myListView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
          />

    </LinearLayout>

</LinearLayout>

The program is failing, and I am not sure what is incorrect here is the log file:

09-07 15:37:20.301: ERROR/AndroidRuntime(294): FATAL EXCEPTION: 
main
09-07 15:37:20.301: ERROR/AndroidRuntime(294): java.lang.RuntimeException: 
Unable to start activity ComponentInfo{geolocation.test/geolocation.test.GeoLocationActivity}: java.lang.NullPointerException
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-07 15:37:20.301: 
ERROR/AndroidRuntime(294):     
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-07 15:37:20.301: 
ERROR/AndroidRuntime(294):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     at android.os.Looper.loop(Looper.java:123)
09-07 15:37:20.301: 
ERROR/AndroidRuntime(294):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     at java.lang.reflect.Method.invokeNative(Native Method)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     at java.lang.reflect.Method.invoke(Method.java:521)
09-07 15:37:20.301: 
ERROR/AndroidRuntime(294):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     at dalvik.system.NativeStart.main(Native Method)
09-07 15:37:20.301: ERROR/AndroidRuntime(294): 
Caused by: java.lang.NullPointerException
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     
at geolocation.test.GeoLocationActivity.onCreate(GeoLocationActivity.java:47)
09-07 15:37:20.301: 
ERROR/AndroidRuntime(294):     
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-07 15:37:20.301: 
ERROR/AndroidRuntime(294):     
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-07 15:37:20.301: ERROR/AndroidRuntime(294):     ... 11 more

Apprently there is a null exception at the following line:

bottomList.setAdapter(new ArrayAdapter<String>(this.getApplicationContext(), R.id.simple_text, AllLocals));

I have no clue why. Help is very much appreciated.

  • 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-25T13:38:41+00:00Added an answer on May 25, 2026 at 1:38 pm

    ok try this
    bottomList.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, AllLocals)); and make sure that u initialize the AllLocals before u call this method

    AllLocals = new ArrayList<String>();

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

Sidebar

Related Questions

I am trying to create a program that tracks bike intervals and creates a
I'm trying to create a program that will display bar graphs with * the
I'm trying to create a program that takes a text file of c++ code
I am trying to create a program that will do some simple calculations, but
I'm currently trying to create a program that estimates location based on signal strength.
I have been trying to create a Ruby program that will be running online
Alright so what I am trying to do is essentially create a program that,
I'm trying to create a program in C# that lists the content of a
I'm trying to create a client-server program that send and receive a string (its
I'm trying to create a program that reads a .docx file and posts it

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.