0

I want to organize my list view like how they do it in the downloads app: Downloads

Currently I am using a ecrusor adapter for my data:

public class eCursorAdapter extends CursorAdapter {
    public eCursorAdapter(Context context, Cursor c) {
        super(context, c);
    }

    @SuppressWarnings("static-access")
    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        TextView summary = (TextView)view.findViewById(R.id.title);
        summary.setText(cursor.getString(
                cursor.getColumnIndex(mDbHelper.KEY_A)));

        TextView progress = (TextView)view.findViewById(R.id.progress);
        progress.setText("");
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(R.layout.download_list, parent, false);
        bindView(v, context, cursor);
        return v;
    }
}

KEY_DATE in my database holds the date info. So how can I make this similar to the downloads app in android?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
arberb
  • 960
  • 3
  • 14
  • 25

1 Answers1

0

Have you considered the ExpandableListView (http://developer.android.com/reference/android/widget/ExpandableListView.html)?

The associated adapter provides two levels of results -- Groups and Children. In this case, your Groups would be your timeframes (Today, Yesterday, etc) and the children would be the data objects that fall into that timeframe. The adapter would have to query the cursor to get the exact counts and data for each Group.

elijah
  • 2,904
  • 1
  • 17
  • 21
  • of what exactly? Using ExpandableListView? there are several tutorials, like http://techdroid.kbeanie.com/2010/09/expandablelistview-on-android.html. if you're wondering about the cursor and the adapter, check out this: http://stackoverflow.com/questions/1463906/how-to-update-expandable-list-view-when-adapters-data-changes – elijah Jan 05 '12 at 20:24