What are you trying to accomplish by doing this?  Surely you don't want to
be starting the activity from scratch again every time just to update the
data that is displayed?

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Fri, Jul 6, 2012 at 5:36 AM, Akhil <[email protected]> wrote:

>
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Reply via email to