我在显示当前修改日期的文件时遇到了一些问题.
public class MyAdapter extends ArrayAdapter<String> {
String dir = "/FileDirectory/";
File file = new File(Environment.getExternalStorageDirectory() + dir);
private final Activity context;
Date lastModified = new Date(file.lastModified());
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
String formattedDateString = formatter.format(lastModified);
private String dateFormat = "dd/MM/yyyy HH:mm:ss";
static class ViewHolder {
public TextView text;
}
public MyAdapter(Activity context, String[] date) {
super(context, R.layout.row, date);
this.context = context;
formatter = new SimpleDateFormat(dateFormat);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View rowView …Run Code Online (Sandbox Code Playgroud)