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
This code for If you want first create the view and after that refreshing page at specified time span then use following code.(here mention refreshing rate is 20 seconds) It Works Fine and Automatic refresh in every 20 seconds.
public class MainActivity extends Activity {
Handler mHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.mHandler = new Handler();
m_Runnable.run();
}
private final Runnable m_Runnable = new Runnable()
{
public void run()
{
Toast.makeText(MainActivity.this,"in runnable",Toast.LENGTH_SHORT).show();
MainActivity.this.mHandler.postDelayed(m_Runnable,20000);
}
};
}