0
我有一個小工具倒計時到指定的日期。例如:12月10日是2天。 我想顯示剩下多少小時甚至幾分鐘。怎麼做?請幫幫我。倒計時的小工具
代碼:
@Override
public void run() {
Date date1 = new Date();
Calendar calendar = new GregorianCalendar(2012, 11,11);
long days = (((calendar.getTimeInMillis()- date1.getTime())/1000))/86400;
remoteViews.setTextViewText(R.id.xmas,""+ days);
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
}
如何顯示小部件上的剩餘時間?在我以這種方式完成之前: remoteViews.setTextViewText(R.id.xmas,「」+ days); appWidgetManager.updateAppWidget(thisWidget,remoteViews); – Goliathus
對於MainActivity類型,formatTime(long)方法未定義 – Goliathus