Hi,

I want to reload my activity after every 1 minute. I tried using handler 
for this... but problem is that when i press back key of device, it doesn't 
stop and goes into an infinite loop..

here is my code what i have done--


public class Chat extends Activity {
Handler handler;
    public void onCreate(Bundle savedInstance) {
        super.onCreate(savedInstance);
        setContentView(R.layout.chat);
        handler = new Handler();
        
        Toast.makeText(getApplicationContext(), "again", 400).show();
        
        doTheAutoRefresh();
    }

    private void doTheAutoRefresh() {
        handler.postDelayed(new Runnable() {
            public void run() {
                Intent intent = getIntent();
                startActivity(intent);
                finish();
                //doTheAutoRefresh();                
            }
        }, 10000);

}
    
    public void onPause(){
        super.onPause();
       }
}


Thanks,
Akhil

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to