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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:33:33+00:00 2026-05-27T06:33:33+00:00

I have a custom adapter that visualize each row in the list of Orders.

  • 0

I have a custom adapter that visualize each row in the list of Orders.

public class OrderRowAdapter extends BaseAdapter implements OnClickListener {
    OrderList items_;
    LayoutInflater inflater_;
    int list_view_resource_id_;
    private final String TAG = "OrderRowAdapter";

    public OrderRowAdapter(Context context, int list_view_resource_id,
            OrderList items) {
        this.list_view_resource_id_ = list_view_resource_id;
        this.items_ = items;
        this.inflater_ = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    public Object getItem(int position) {
        return items_.getOrders(position);
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        Log.d(TAG, "View updated for item in position = " + position);

        View v = convertView;
        if (v == null) {
            v = inflater_.inflate(list_view_resource_id_, parent);
        }

        Order item = items_.getOrders(position);
        if (item != null) {
            TextView order_info_tv = (TextView) v.findViewById(R.id.order_info);
            TextView order_status_tv = (TextView) v.findViewById(R.id.order_status);

            if (order_info_tv != null) {
                order_info_tv.setText(
                        String.format("For customer: %s\nTotal of %d items", item.getCustomerId(), item.getItemsCount()));
            }
            if (order_status_tv != null) {
                order_status_tv.setText("Status: " + getStatusText(item.getStatus()));
            }
        }
        return v;
    }

    public int getCount() {
        if (items_ == null) {
            Log.d(TAG, "Null so get count returned 0");
            return 0;
        } else {
            Log.d(TAG, "Get count returned " + items_.getOrdersCount());
            return items_.getOrdersCount();
        }
    };

After querying new list of orders from a web service, I want to update the content of the ListView, so I have my Activity does the updating before calling notifyDataSetChanged()

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

    initThreading();
    findViews();
    setUrls();

    // Load the list of order from disk
    try {
        order_list_ = OrderList.parseFrom(new FileInputStream(
                "/sdcard/orderList.bin"));
    } catch (FileNotFoundException e) {
        Log.e(TAG, "Cannot find the file", e);
    } catch (IOException e) {
        Log.e(TAG, "Cannot read the file", e);
    }

    order_row_adapter_ = new OrderRowAdapter(OrderActivity.this,
            R.layout.order_row, order_list_);
    orders_listview_.setAdapter(order_row_adapter_);

    // Request new updates from the server
    updateOrderInformation(-1);
}

public void updateOrders(InputStream new_order_stream) {
    Log.d(TAG, "Updating order UI");
    try {
        order_list_.parseFrom(new_order_stream);
    } catch (IOException e) {
        Log.e(TAG, "IOException" , e);
    }

    runOnUiThread(new Runnable() {
        public void run() {
            guiUpdateOrders();
        }
    });
}

private void guiUpdateOrders() {
    order_row_adapter_.notifyDataSetChanged();
    Log.d(TAG, "Dataset notified that it has changed. GUI update anytime now.");
}

But, the getView() method of OrderRowAdapter is never called. The ListView is never updated.

  • 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-27T06:33:34+00:00Added an answer on May 27, 2026 at 6:33 am

    It turns out the problem with my getView() not being called is because it is not visible. My layout xml has the upper TextView with fill_parent for its height. Thus the entire view only has that single TextView visible.

    Solution: check the graphical view of the layout in question to make sure the ListView is visible.

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

Sidebar

Related Questions

I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I have a custom list adapter: class ResultsListAdapter extends ArrayAdapter<RecordItem> { in the overridden
I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter
Currently, I have a custom list adapter that has some logic that hide/show a
I have a ListView with a custom adapter that extends CursorAdapter. that ListView also
I have created a custom Array Adapter to bind a custom row that contains
I have a custom ListView adapter which implements an ImageThreadLoader class. Unfortunately, the class
I have a custom ListView adapter which implements an ImageThreadLoader class. Unfortunately the class
I have listed a list with custom adapter to display different images in each
I have a listView using a custom adapter. Each row contains a button and

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.