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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:28:59+00:00 2026-06-05T09:28:59+00:00

I have the following code in one of my apps. I get a runtime

  • 0

I have the following code in one of my apps. I get a runtime error in this

public class MainActivity extends Activity {
    private SQLiteAdapter mySQLiteAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        ListView listContent = (ListView) findViewById(R.id.listView1);
        mySQLiteAdapter = new SQLiteAdapter(this);
        mySQLiteAdapter.openToRead();
        Cursor cursor = mySQLiteAdapter.queueAll();
        startManagingCursor(cursor);
        String[] from = new String[] { SQLiteAdapter.KEY_CONTENT };
        int[] to = new int[] { R.id.textView1, R.id.textView2 };
        SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this,
                R.layout.row, cursor, from, to);
        listContent.setAdapter(cursorAdapter);
        mySQLiteAdapter.close();
    }
}

The error follows:

06-08 00:04:17.133: E/AndroidRuntime(7072): FATAL EXCEPTION: main
06-08 00:04:17.133: E/AndroidRuntime(7072): java.lang.RuntimeException: Unable to start activity ComponentInfo{bl.ock/bl.ock.MainActivity}: java.lang.NullPointerException
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1768)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.os.Looper.loop(Looper.java:130)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.app.ActivityThread.main(ActivityThread.java:3835)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at java.lang.reflect.Method.invokeNative(Native Method)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at java.lang.reflect.Method.invoke(Method.java:507)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at dalvik.system.NativeStart.main(Native Method)
06-08 00:04:17.133: E/AndroidRuntime(7072): Caused by: java.lang.NullPointerException
06-08 00:04:17.133: E/AndroidRuntime(7072):     at bl.ock.MainActivity.onCreate(MainActivity.java:28)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-08 00:04:17.133: E/AndroidRuntime(7072):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
06-08 00:04:17.133: E/AndroidRuntime(7072):     ... 11 more

Please help me solve this.
Thank YOu.

  • 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-05T09:29:00+00:00Added an answer on June 5, 2026 at 9:29 am

    setContetView(<your_layout_id>) in missing in onCreate() function before getting the list using findViewById()

        super.onCreate(savedInstanceState);
         setContetView(<your_layout_id>);<------------------
        ListView listContent = (ListView) findViewById(R.id.listView1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Scala IDE I have the following code: package pkg.one object S { class
I have the following code in one of our projects webpages: XmlDocument xDoc =
Using linkedin-j , I have the following code in one part of my application
I have the following code snippet: enum { one } x; enum { two
I have the following code and everytime I click on one of the markers,
I have the following code which swaps out one divs innerHTML for the others
I have the following code which copies property values from one object to another
I have the following code which takes a touch on one button and draws
Let's say that I have the following code that's run in one thread of
I have the following C# code to launch an outlook window. The one think

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.