我有一个 RecyclerView 显示带有标题、文本和上次编辑时间的项目。

在 RecyclerView 适配器的 onBindViewHolder 中,我使用getRelativeTimeSpanString并将笔记对象的时间与当前时间进行比较:
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Note note = getItem(position);
holder.title.setText(note.getTitle());
holder.text.setText(note.getText());
String s = DateUtils.getRelativeTimeSpanString(note.getTime(),
System.currentTimeMillis(), 0L, DateUtils.FORMAT_ABBREV_ALL).toString();
holder.timestamp.setText(s);
}
Run Code Online (Sandbox Code Playgroud)
如果我刚刚添加了该项目,它会显示“0 秒前”。我如何随着时间的推移更新它?
在写这个问题时,SO 提出了这个问题:更新 android 中的相对时间,但是我不认为每 X 秒更新一次 RecyclerView 是最好的主意:
holder.timestamp
每 X 秒更新一次)有没有更有效的方法来实现这一目标?