param param - 4 months ago 39
Android Question

Auto refresh the activity

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

Please suggest and provide some code block if possible.

Answer

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