dark_shadow dark_shadow - 4 years ago 106
Android Question

How to put some delay in calling an activity from another activity?

I have an application in which I'm receiving a sms containing his location.On receiving sms it calls another activity to start and passes that location to that activity to plot it on the map.Before calling the second activity it shows a toast like notification on the screen but somehoe due to calling second activity that toast doesn't come up.My question is how can we delay the calling of second activity from this activity ?

Answer Source

You can use something like this:

 new Handler().postDelayed(new Runnable() {
                      public void run() {

                          Intent i=new Intent(SearxhJobs.this,JobsTypes.class);
                  }, 5000);

Here it waits upto 5 seconds to launch activity.

Hope it helps

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download