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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:39:37+00:00 2026-06-04T20:39:37+00:00

In my onCreate method I call to other methods, namely fillData() and fillImages. What

  • 0

In my onCreate method I call to other methods, namely fillData() and fillImages. What fillData does is, it fills a row in a Listview with text, fillImages puts an image in the row. So far so good.
Obviously when I ONLY call fillData in my onCreate method only the text shows up. The same happens when I just call fillImages.

The problem is when I call both of them only the content of them method that I called last shows up.
Example: When I call this:

@Override
public void onCreate() {
    //Here is some content left away that is not important.
    fillData();
    fillImages()
}

I only get the content of the fillImages() method.

What am I doing wrong? Below you find the code for my onCreate(), fillData() and fillImages() method.

UPDATE: HOW CAN I SOLVE THIS PROBLEM???

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reminder_list);
    mDbHelper = new RemindersDbAdapter(this);
    mImageHelper = new ImageAdapter(this);
    mDbHelper.open();
    mImageHelper.open();
    fillData();
    fillImages();
    registerForContextMenu(getListView());
}

//
// Fills the ListView with the data from the SQLite Database.
//
private void fillData() {
    Cursor remindersCursor = mDbHelper.fetchAllReminders();
    startManagingCursor(remindersCursor);

    // Creates an array with the task title.
    String[] from = new String[] {RemindersDbAdapter.KEY_TITLE, RemindersDbAdapter.KEY_BODY};

    // Creates an array for the text.
    int[] to = new int[] {R.id.text1, R.id.text2};

    // SimpleCursorAdapter which is displayed.
    SimpleCursorAdapter reminders = new SimpleCursorAdapter(this, R.layout.reminder_row, remindersCursor, from, to);
    setListAdapter(reminders);

}

//
// Fills the ListView with the images from the SQLite Database.
//
private void fillImages() {
    Cursor imageCursor = mImageHelper.fetchAllImages();
    startManagingCursor(imageCursor);

    // Creates an array with the image path.
    String[] fromImage = new String[] {ImageAdapter.KEY_IMAGE};

    // Creates an array for the text.
    int[] toImage = new int[] {R.id.icon};

    // SimpleCursorAdapter which is displayed.
    SimpleCursorAdapter images = new SimpleCursorAdapter(this, R.layout.reminder_row, imageCursor, fromImage, toImage);
    setListAdapter(images);
}
  • 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-04T20:39:38+00:00Added an answer on June 4, 2026 at 8:39 pm

    Why does my SimpleCursorAdapter override my other SimpleCursorAdapter?

    You are using the term override incorrectly. Method overriding is when a subclass provides a specific implementation of a method that is provided in its superclass. This is totally unrelated to the problem you are having.

    What am I doing wrong?

    The reason why your code isn’t working is because you are calling setListAdapter twice. The second call to setListAdapater un-binds the first adapter and then binds the second adapter to your ListView, thus rendering your first call totally useless. Your ListActivity‘s ListView can only have one adapter (so you are going to need to merge your implementations of the two adapters somehow).

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

Sidebar

Related Questions

How to avoid calling onCreate method after incoming call or any other idea about
I have Activity with ListView inside it and in the onCreate method of the
I want to create a listview that immediately when initialized in the onCreate() method
I have a conundrum, I do know how to call method from other activity..
I have a listview with each row having a checkbox, imageview and text view
I have a TextView in the xml and from the OnCreate method I call
I have the following code which gets call in my main activity's onCreate method
When my application's orientation change every time onCreate() method call. It makes me difficult
TextView t =(TextView)findViewById(R.id.place); t.setText(A); i call the above code inside onCreate() method. My activity
In my activity oncreate method, i have called a service using OnStartCommand(). My requirement

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.