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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:33:18+00:00 2026-06-11T04:33:18+00:00

I have a listview in my code and I want to set adapter on

  • 0

I have a listview in my code and I want to set adapter on it.

But the issue is, even after initializing the listview, it is still null resulting into nullPointerException. (I checked it by logging and debugging)

I’m not able to access any view from that xml.

What am I missing? Any help appreciated.

xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:scrollbars="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <ListView
            android:id="@+id/lvToday"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:divider="#FFF"
            android:dividerHeight="2dp" />

        <ListView
            android:id="@+id/lvTomorrow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/lvToday"
            android:divider="#FFF"
            android:dividerHeight="2dp" />
    </RelativeLayout>

</ScrollView>

Activity file

public class DashboardActivity extends Activity {

ListView lvToday, lvTomorrow;
TextView lblCall;

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

private void init() {
    lvToday = (ListView) findViewById(R.id.lvToday);
    lvTomorrow = (ListView) findViewById(R.id.lvTomorrow);

    TodayAppAdapter adapter = new TodayAppAdapter(DashboardActivity.this,
            DashboardActivity.this);
                // This line is giving NULL
    lvToday.setAdapter(adapter);

    TomorrowAppAdapter adapter1 = new TomorrowAppAdapter(
            DashboardActivity.this, DashboardActivity.this);
                // This line is giving NULL
    lvTomorrow.setAdapter(adapter1);
}
}
  • 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-11T04:33:20+00:00Added an answer on June 11, 2026 at 4:33 am

    1) test eclipse menu: Project -> Clean…

    2) if you have more than one version for your xml layout (example layout-large, layout-xlarge,…), check if all of them have your view.

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

Sidebar

Related Questions

I want to know when my listview has no adapter set on it. I
I have a ListView with different DataTemplate s set up to bind. I want
I want to set an adapter to a ListView where the ListView's items are
enter code here I have a ListView that have a different Layout XML for
Suppose we have this example: http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html with source code available here: http://code.google.com/p/myandroidwidgets/source/browse/trunk/Phonebook/src/com/abeanie/ How can
how to see items that i pick on ListView ? i have this code:
I have listview control.There is an option to remove selected items.After the user removes
I have a problem displaying the results of an sql query into a ListView
I have a ListView that I want to use with an ArrayAdapter to add
In My app i have implement the ListView . Now i want it to

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.