use timer task class as and call it every 5 seconds
class RemindTask extends TimerTask {
@Override
public void run() {
System.out.println("ReminderTask is completed by Java timer");
Intent dialogIntent = new Intent(getBaseContext(), myActivity.class);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(dialogIntent);
}
}
call to timer task as
ReminderTask timer = new Timer(); //At this line a new Thread will be created
timer.schedule(new RemindTask(), 5*1000, 5*1000); //delay in milliseconds