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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:21:13+00:00 2026-05-30T20:21:13+00:00

I create a dialog and populate it with a listview that uses a custom

  • 0

I create a dialog and populate it with a listview that uses a custom list adapter. It works fine, but I’ve noticed that when the list is long enough to scroll, doing so back and forth will cause some of my list items to randomly lose some of their data. I’ve noticed it is always the same list items too. For instance, each list item will have a title, image, and date on it. The dates seem to vanish on some when I scroll. They are always there when I start the dialog, and they always vanish once I scroll.

The weird thing is that my list row consists of a few TextViews in 2 rows and its only the bottom row TextViews that dissapear…Any ideas?

Code for my dialog

 itemSendPickerDialog = new Dialog(this);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
   builder.setTitle("Select Item to Send");
    ListView lv = new ListView(this);
    Cursor c = mDbHelper.fetchItemsByDate(id);
    c.moveToFirst();

    int i = R.layout.send_item_menu_row;
    MyListAdapter ia = new MyListAdapter(this, mainListBackground, c, true);
    lv.setAdapter(ia);

    builder.setView(lv);
    itemSendPickerDialog = builder.create();
    itemSendPickerDialog.show();

And my custom list adapter class:

class MyListAdapter extends ResourceCursorAdapter {
    public MyListAdapter(Context context, int i, Cursor cursor, boolean...sending) {
        super(context, i, cursor);
    }

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

        TextView title = (TextView) view.findViewById(R.id.item_name);

        title.setText(cursor.getString(cursor.getColumnIndex(TripsDbAdapter.KEY_ITEM_TITLE)));

        Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
        int width = display.getWidth();
        width = width - 150;
        ViewGroup.LayoutParams params = title.getLayoutParams();
        params.width = width;
        title.setLayoutParams(params);

        String cat = cursor.getString(cursor.getColumnIndex(TripsDbAdapter.KEY_ITEM_CATEGORY));
        if (cat.equalsIgnoreCase("trip notes")) {
            LinearLayout ll = (LinearLayout) view.findViewById(R.id.item_datetime_holder);
            ll.setVisibility(View.INVISIBLE);
        }
        TextView date = (TextView) view.findViewById(R.id.item_date);
        date.setText(cursor.getString(cursor.getColumnIndex(TripsDbAdapter.KEY_DEP_DATE)));

        TextView time = (TextView) view.findViewById(R.id.item_time);
        time.setText(cursor.getString(cursor.getColumnIndex(TripsDbAdapter.KEY_DEP_TIME)));

        ImageView iv = (ImageView) view.findViewById(R.id.image_icon);
        if (iv != null) {
            int index = cursor.getColumnIndex(TripsDbAdapter.KEY_ITEM_TYPE);

            String type = cursor.getString(index);
            if (type != null) {

            } else {
                type = "notes";
            }

            iv.setImageResource(getTypeResource(type));
        }

    }
}
  • 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-30T20:21:14+00:00Added an answer on May 30, 2026 at 8:21 pm

    I’ve figured out that the code that is doing this is in my custom list adapter class

    String cat = cursor.getString(cursor.getColumnIndex(TripsDbAdapter.KEY_ITEM_CATEGORY));
            if (cat.equalsIgnoreCase("trip notes")) {   
                LinearLayout ll = (LinearLayout) view.findViewById(R.id.item_datetime_holder);
                ll.setVisibility(View.INVISIBLE);
            }
    

    I hide some of the layout items depending on what the category is, and for some reason when putting a list view in an AlertDialog builder it appears to mix up the items. I don’t know exactly how I am going to fix it, but for now if I just remove the invisibility functionality, my data won’t go away.

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

Sidebar

Related Questions

I have a small custom dialog in wich I have a ListView with id:list.
I create an alert dialog that has a basic checkbox list in it when
I want to create a dialog that contains some kind of text element (JLabel/JTextArea
I need create custom dialog and put JPanel into it. Is it possible?
I am trying to create a dialog box that will appear only if the
Is there anyway to create a dialog that is modal to a view and
I'm trying to generate a custom dialog in Android. I create my Dialog like
I have an AlertDialog populated by an ExpandableListView. The list itself works perfectly, but
this might be a stupid question, but I'm using asp.net list control that creates
through the help of various tutorials, I've managed to write a custom dialog that

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.