How to call another activity after certain time limit

How to give time limit for calling one activity to another activity. I want to call another activity (Ex calling A class to B class) by given some time limit. I used alarmManager, but it is not possible for my application also i used threading, whenever i give Thread.sleep it will not perform action till the sleep getting end. I am not sure how to do this process. can anyone give a idea of giving time limit to calling a class.


You could use a Timer and add a TimerTask that is executed after a specific delay.

Here is a more or less completed example:

Timer timer = new Timer();
timer.schedule(new TimerTask() {

   public void run() {

      //here you can start your Activity B.


}, 10000);

The example above executes a new TimerTask in 10 seconds. Inside the TimerTask you can override the run method. In the run method you can start your new activity. The run method is executed after the delay. In this example it is 10’000 milliseconds.

Leave a Reply

Your email address will not be published. Required fields are marked *