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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:57:13+00:00 2026-05-27T18:57:13+00:00

I’ve seen previous topics on the subject like this one: Android: Issue with newView

  • 0

I’ve seen previous topics on the subject like this one: Android: Issue with newView and bindView in custom SimpleCursorAdapter and still can’t understand what the problem with my code is. I’ve read books on it, etc, etc and can’t get it why I’m not getting it right.

The problem is when I scroll my listView I get rows with the wrong data but if I click the row and get into the next activity it correspond to the data it’s supposed to have.

I implemented a viewHolder for the date to bind to the rows in the newView / bindview methods.

Everything displays well till I start to scroll the list view. That’s when the rows start to get all mixed up. That has to do with the recycling of views, that I know, how to fix it, that I’m still trying to figure it out. I would love any help!

The code of my SimplecursorAdapter:

public class DropNotesAdapter extends SimpleCursorAdapter {

private LayoutInflater layoutInflater;
private Utils mUtils = new Utils();
private int layout;
private int titleColIndex;
private int modifiedColIndex;
private int priorityColIndex;

public DropNotesAdapter(Context context, int layout, Cursor c, String[] from, int[] to) {

    super(context, layout, c, from, to);
    this.layout = layout;
    layoutInflater = LayoutInflater.from(context);
    titleColIndex = c.getColumnIndex(DropNotesDBAdapter.KEY_TITLE);
    modifiedColIndex = c.getColumnIndex(DropNotesDBAdapter.KEY_MODIFIED);
    priorityColIndex =c.getColumnIndex(DropNotesDBAdapter.KEY_PRIORITY);
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {

    View view = layoutInflater.inflate(layout, parent, false);

    TextView titleText = (TextView) view.findViewById(R.id.title_line);
    TextView modifiedText = (TextView) view.findViewById(R.id.date_line);
    ImageView priorityTag = (ImageView) view.findViewById(R.id.item_priority);

    NoteHolder holder = new NoteHolder();
    holder.titleView = titleText;
    holder.modifiedView = modifiedText;
    holder.priorityView = priorityTag;
    holder.title = cursor.getString(titleColIndex);
    holder.modified = mUtils.formatDate(mUtils.formatDateFromString (cursor.getString(modifiedColIndex), context, "dd-MM-yyyy"));
    holder.priorityResId = mUtils.getPriorityResourceId(cursor.getInt(priorityColIndex));
    view.setTag(holder);

    return view;
}

@Override
public void bindView(View view, Context context, Cursor cursor) {

    NoteHolder holder = (NoteHolder) view.getTag();

    holder.titleView.setText(holder.title);
    holder.modifiedView.setText(holder.modified);
    holder.priorityView.setImageResource(holder.priorityResId);

    Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/ARLRDBD.TTF");
    holder.titleView.setTypeface(tf);
    holder.modifiedView.setTypeface(tf);
}

private static class NoteHolder {
    TextView titleView;
    TextView modifiedView;
    ImageView priorityView;
    String title;
    String modified;
    int priorityResId;
}

}

  • 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-27T18:57:14+00:00Added an answer on May 27, 2026 at 6:57 pm

    Get rid of title, modified, and priorityResId from NoteHolder. A holder holds widgets that are in the associated row. A holder does not hold model data. You get your model data in bindView() from the Cursor.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string

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.