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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:50:33+00:00 2026-05-24T10:50:33+00:00

I keep getting the following nullPointerException and I can’t quite figure it out any

  • 0

I keep getting the following nullPointerException and I can’t quite figure it out any help would be greatly appreciated. The program query() from DB and then use adapter to populate ListView.

   public class ViewListingsActivity extends Activity {
    SQLiteDatabase db;
    ListView listview;
    Button button;
    SimpleCursorAdapter adapter;
    private static final String TAG = DBHelper.class.getSimpleName();
    public static final String DB_ADDRESS = BaseColumns._ID;
    public static final String DB_DESCRIPTION = "Description";
    public static final String DB_URL = "URL";
    final String dbTable = "Realtor_SMS_Table";

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.viewlisting);
        listview = (ListView) findViewById(R.id.list);
        button = (Button) findViewById(R.id.button1);
        DBHelper dbhelper = new DBHelper(ViewListingsActivity.this);
        db = dbhelper.getWritableDatabase();

        Cursor cursor = db.query(dbTable, null, null, null, null, null, null);
        startManagingCursor(cursor);

        String[] from = new String[] { DB_ADDRESS, DB_DESCRIPTION, DB_URL };
        int[] to = new int[] { R.id.textlistaddress, R.id.textlistdescription,
                R.id.textlisturl };
        adapter = new SimpleCursorAdapter(this, R.layout.rowlist, cursor, from,
                to);
        listview.setAdapter(adapter);

    }
}

here is my stack trace

----- pid 764 at 2011-08-05 13:26:24 -----
Cmd line: com.RealtorSMS

DALVIK THREADS:
"main" prio=5 tid=3 NATIVE
  | group="main" sCount=1 dsCount=0 s=0 obj=0x40018e70
  | sysTid=764 nice=0 sched=0/0 handle=-1096475492
  at android.os.BinderProxy.transact(Native Method)
  at android.app.ActivityManagerProxy.handleApplicationError(ActivityManagerNative.java:2103)
  at com.android.internal.os.RuntimeInit.crash(RuntimeInit.java:302)
  at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:75)
  at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:887)
  at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:884)
  at dalvik.system.NativeStart.main(Native Method)

"Binder Thread #3" prio=5 tid=15 NATIVE
  | group="main" sCount=1 dsCount=0 s=0 obj=0x43594008
  | sysTid=771 nice=0 sched=0/0 handle=1505008
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #2" prio=5 tid=13 NATIVE
  | group="main" sCount=1 dsCount=0 s=0 obj=0x43590120
  | sysTid=770 nice=0 sched=0/0 handle=1487504
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=11 NATIVE
  | group="main" sCount=1 dsCount=0 s=0 obj=0x4358e9b0
  | sysTid=769 nice=0 sched=0/0 handle=1396928
  at dalvik.system.NativeStart.run(Native Method)

"JDWP" daemon prio=5 tid=9 VMWAIT
  | group="system" sCount=1 dsCount=0 s=0 obj=0x4358d2a0
  | sysTid=768 nice=0 sched=0/0 handle=1493656
  at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=7 RUNNABLE
  | group="system" sCount=0 dsCount=0 s=0 obj=0x4358d1e8
  | sysTid=767 nice=0 sched=0/0 handle=1490832
  at dalvik.system.NativeStart.run(Native Method)

"HeapWorker" daemon prio=5 tid=5 VMWAIT
  | group="system" sCount=1 dsCount=0 s=0 obj=0x427d1928
  | sysTid=765 nice=0 sched=0/0 handle=1488192
  at dalvik.system.NativeStart.run(Native Method)

----- end 764 -----

Here are the two xmls

rowlist.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
    <TextView android:layout_height="wrap_content" android:text="TextView" android:layout_width="match_parent" android:id="@+id/textlistaddress"></TextView>
    <TextView android:layout_height="wrap_content" android:text="TextView" android:layout_width="match_parent" android:id="@+id/textlistdescription"></TextView>
    <TextView android:layout_height="wrap_content" android:text="TextView" android:layout_width="match_parent" android:id="@+id/textlisturl"></TextView>

</LinearLayout>

viewlisting.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent" android:background="@drawable/realtorbackground"
    android:weightSum="1">
    <TextView android:layout_weight="0.08" android:layout_height="wrap_content"
        android:layout_width="match_parent" android:id="@+id/textViewtitleview"
        android:gravity="center" android:textSize="30dp" android:text="Current Listings"></TextView>
    <ListView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/list"></ListView>
    <Button android:id="@+id/button1" android:layout_width="match_parent"
        android:layout_height="wrap_content" android:text="Delete Listing"></Button>

</LinearLayout>

here is the logcat:

08-05 13:26:24.077: ERROR/AndroidRuntime(764): Uncaught handler: thread main exiting due to uncaught exception
08-05 13:26:24.087: ERROR/AndroidRuntime(764): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.RealtorSMS/com.RealtorSMS.ViewListingsActivity}: java.lang.NullPointerException
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.os.Looper.loop(Looper.java:123)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.app.ActivityThread.main(ActivityThread.java:3948)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at java.lang.reflect.Method.invokeNative(Native Method)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at java.lang.reflect.Method.invoke(Method.java:521)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at dalvik.system.NativeStart.main(Native Method)
08-05 13:26:24.087: ERROR/AndroidRuntime(764): Caused by: java.lang.NullPointerException
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at com.RealtorSMS.ViewListingsActivity.onCreate(ViewListingsActivity.java:39)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
08-05 13:26:24.087: ERROR/AndroidRuntime(764):     ... 11 more
  • 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-24T10:50:33+00:00Added an answer on May 24, 2026 at 10:50 am

    check viewlisting.xml, It does not contain ListView with id R.id.list

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

Sidebar

Related Questions

I can't figure out why I keep getting the following errors with the following
I keep getting the following error: * #1005 - Can't create table 'classorganizer.turma' (errno:
Good day, Any idea why i could be getting a NullPointerException in the following
I keep getting the following errors: 2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result
When I make an Intellij project, I keep getting the following out of memory
I keep getting the following error: Parse error: syntax error, unexpected T_SL in /home/a4999406/public_html/willingLog.html
I keep getting the following error: AttributeError: Caribou instance has no attribute 'on_key_up' The
I keep getting the following error message ERROR 1064 (42000): You have an error
I keep getting the following error when trying to build the masstransit source from
I keep getting the following error when trying to run a login script I

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.