我正在尝试让我的倒计时应用程序执行其更新我当前时间和日期TextView的功能,并每秒触发其MyOnItemSelectedListener,以便应用程序动态倒计时而不是仅在启动onCreate时.如果有一个更有效的方法然后快速解雇MyOnItemSelectedListener我会很感激批评.
public class TheCount extends Activity {
TextView description=null;
TextView dates=null;
TextView times=null;
TextView output=null;
TextView cDateDisplay=null;
TextView cTimeDisplay=null;
private int mYear;
private int mMonth;
private int mDay;
private int mHour;
private int mMinute;
private int mSecond;
CountdownHelper helper=null;
String countdownId=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.thecount);
helper=new CountdownHelper(this);
cTimeDisplay = (TextView)findViewById(R.id.lblCurTime);
cDateDisplay = (TextView)findViewById(R.id.lblCurDate);
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE);
mSecond = c.get(Calendar.SECOND); …Run Code Online (Sandbox Code Playgroud) 我的 Android 应用程序TextView告诉用户数据年龄(“13 分钟前”)。我目前每秒更新一次,使用 aRunnable来捕捉当分钟更改notifyDataSetChanged()为我的适配器时。但这会导致每秒垃圾收集...
TextView当系统时钟每分钟发生变化时,是否有另一种方法来触发更新(或采取一般措施),而无需每秒检查此类变化?