所以,我需要两个选项之一,但不知道从哪里开始无论是。
So I need one of two options but don't know where to start with either.
-
我有一个recyclerview列表卡的看法。每张卡片视图需要有倒计时实现并能同时运行。 (好像更难选项)或
I have a list card views in a recyclerview. Each card view needs to have countdown timer implemented and able to run simultaneously. (Seems like the harder option) OR
更新的基础上卡片视图中的文本,如果指定的时间或系统时间达到指定分钟和小时。
Update the text in a card view based on if a specified time has elapsed or system time reaches a specified minute and hour.
推荐答案要使用不同的定时器,你需要做的线程卡。而在Android的最简单的方法是的AsyncTask 。所以你创建了一堆的AsyncTask S(可能你会希望有一个的ArrayList 来,你会添加的AsyncTask S),然后用一个简单的循环 .execute()他们。
To make the cards with different timers you will need threads. And the easiest way in Android is AsyncTask. So you create a bunch of AsyncTasks (probably you'd want an ArrayList to which you will add the AsyncTasks) and then with a cycle simply .execute() them.
作出的AsyncTask 是很容易的。您只需做一个从的AsyncTask 派生新类并实现 doInBackground()方法。
Making an AsyncTask is very easy. You simply make a new class that is derived from AsyncTask and implement the doInBackground() method.
P.S。如果你正在为Android 3.0及更高的发展,您将需要启动AsyncTasks这种方式:
P.S. If you're developing for Android 3.0 and higher you will need to launch AsyncTasks this way:
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);这会让他们同时运行
更多推荐
如何根据时间和日期更改文本?
发布评论