更新ListView控件的TextView VOM Asyntask [英] Update ListView Textview vom Asyntask
本文介绍了更新ListView控件的TextView VOM Asyntask的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从我的AsyncTask更新一个TextView。我为ListView的自定义适配器,并在那里,我希望为每个条目倒计时。我将启动AsyncTask的从我的适配器每个条目。我怎样才能更新的TextView从AsyncTask的每一秒?
i need to update a textView from my asynctask. I have an custom adapter for the listview and there i want to have a countdown for each entry. I will start the asynctask for each entry from my Adapter. How can i update the textview each second from the asynctask?
感谢您的帮助:)
推荐答案
如果您发布code,我可以给你一个更好的答案。然而,定期更新视图的常用方法是使用处理程序。
If you post your code, I can give you a better answer. However, a common way to update views periodically is by using Handlers.
private final Handler mHandler = new Handler(); //intialize in main thread
public void test() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mTextView.setText("hello");
}
}, 1000);
}
这篇关于更新ListView控件的TextView VOM Asyntask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文