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
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
@Override
protected void onPause() {
super.onPause();
mHandler.removeCallbacks(m_Runnable);
finish();
}
/*Above method needs to be there otherwise activity will be updating itself again and again even if the activity is paused i.e. back button or home button is pressed*/