自动刷新活动 [英] Auto refresh the activity

查看:89
本文介绍了自动刷新活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我有一个从互联网上显示内容的活动......我只是想知道我怎么能自动刷新活动......

In my application I have a activity that displays contents from internet..... I just want to know how can I auto refresh the activity.....

请建议,如果可能,提供一些code座。

Please suggest and provide some code block if possible.

推荐答案

试试这个,它工作得很好:)

try this one, it works well :)

    public void onCreate(Bundle savedInstanceState)  
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    this.mHandler = new Handler();

    this.mHandler.postDelayed(m_Runnable,5000);


}//onCreate

private final Runnable m_Runnable = new Runnable()
{
    public void run()

    {
        Toast.makeText(refresh.this,"in runnable",Toast.LENGTH_SHORT).show();

        refresh.this.mHandler.postDelayed(m_Runnable, 5000);            
    }

};//runnable

这篇关于自动刷新活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆