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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:57:10+00:00 2026-05-21T04:57:10+00:00

I’m working for hours on an error I get, when I want to start

  • 0

I’m working for hours on an error I get, when I want to start a ListActivity.
Short workaround about what I want to do:
I have a main application with a normal menu, from which I want to start a setting list where the user can add specific settings.

I’m trying to start the ListView like this:

startActivity(new Intent(this, FileManagerSettings.class));

Then in the on Create method I got the error:

        userSettings = deserializeObject();

    if(userSettings.isEmpty())
    {
        userSettings.add(new SettingItem("Camera", android.os.Environment.DIRECTORY_DCIM, false));
    }
    super.onCreate(icicle);
    Context mContext = this.getApplicationContext(); 
    settingsList = (ListView)findViewById(R.id.list_settings);
    settingsList.setAdapter(new CustomSettingsAdapter(mContext, userSettings));

The last line causes the error. For better understanding here the Constructor of the adapter class:

     public CustomSettingsAdapter(Context context, ArrayList<SettingItem> sitems)
 {
     settingsArrayList = sitems;
     mInflater = LayoutInflater.from(context);
 }

And here is the error from the logcat: (Sorry, don’t know how to format it right)

04-01 11:07:26.756: ERROR/AndroidRuntime(375): FATAL EXCEPTION: main
04-01 11:07:26.756: ERROR/AndroidRuntime(375): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.openintents.filemanager/org.openintents.filemanager.FileManagerSettings}: java.lang.NullPointerException
04-01 11:07:26.756: ERROR/AndroidRuntime(375): Caused by: java.lang.NullPointerException
04-01 11:07:26.756: ERROR/AndroidRuntime(375): at org.openintents.filemanager.FileManagerSettings.onCreate(FileManagerSettings.java:43)

In my thinking the error is caused because the LayoutInflater of the context is null… But I don’t know how to get the LayoutInflater then and even don’t know if this is really the error…

edit: error log with using setContentView():

04-01 12:06:56.315: ERROR/AndroidRuntime(669): FATAL EXCEPTION: main
04-01 12:06:56.315: ERROR/AndroidRuntime(669): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.openintents.filemanager/org.openintents.filemanager.FileManagerSettings}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is ‘android.R.id.list’

this is the xml-File:

<LinearLayout android:layout_width="fill_parent"
    android:id="@+id/list"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <TextView android:id="@+id/settings_list_title"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="@string/settings_header"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:gravity="center" />
    <ListView android:id="@+id/list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    </LinearLayout>
  • 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-21T04:57:11+00:00Added an answer on May 21, 2026 at 4:57 am

    findViewById() only returns a valid reference to a View if the layout of the Activty has been set. Looking at the code you have pasted in to your question, it does not appear that you are making a call to

    setContentView(R.layout.whatever_your_layout_file_id);
    

    Your variable settingsList, would then be a null reference

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

Sidebar

Related Questions

No related questions found

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.