Modifying SimpleCursorAdapter's data

后端 未结 1 1917
南笙
南笙 2020-12-08 22:07

I\'m working on a TV Guide app which uses a ListActivity showing the TV shows for one channel / one day at a time. I\'m using a RelativeLayout for

相关标签:
1条回答
  • 2020-12-08 22:59

    You can do something like this:

    adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
        @Override
        public boolean setViewValue(View view, Cursor cursor, int column) {
            if( column == 0 ){ // let's suppose that the column 0 is the date
                TextView tv = (TextView) view;
                String dateStr = cursor.getString(cursor.getColumnIndex("name_of_the_date_column"));
                // here you use SimpleDateFormat to bla blah blah
                tv.setText(theFormatedDate);
                return true;
            }
            return false;
        }
    });
    
    0 讨论(0)
提交回复
热议问题