I wrote my SimpleCursorAdapter, here is its method:

@Override public void bindView(View view, Context context, Cursor cursor) { super.bindView(view, context, cursor); String hours = cursor.getString(cursor.getColumnIndex("HOURS")); String minutes = cursor.getString(cursor.getColumnIndex("MINUTES")); String days = cursor.getString(cursor.getColumnIndex("DAYS")); TextView hourTV = (TextView) view.findViewById(R.id.hours); TextView minutesTV = (TextView) view.findViewById(R.id.minutes); TextView daysTV = (TextView) view.findViewById(R.id.days); if(Integer.parseInt(hours) >= 0 || Integer.parseInt(hours) <= 9){ hourTV.setText(String.format("%02d", Integer.parseInt(hours))); } else { hourTV.setText(hours); } if(Integer.parseInt(minutes) >= 0 || Integer.parseInt(minutes) <= 9){ minutesTV.setText(String.format("%02d", Integer.parseInt(minutes))); } else { minutesTV.setText(minutes); } daysTV.setText(days); } 

It seems to do everything according to the instructions, but I get an error:

 java.util.MissingFormatArgumentException: Format specifier: 02d 

    2 answers 2

    Must be

     hourTV.setText(String.format("%02d", Integer.parseInt(hours))); 

    %d expects to see an integer as an argument, and you have a string.

    • corrected, still the same mistake - Ivan

    The problem was writing to SQLite. The question is more irrelevant