Reputation: 271
What I want is 5 minutes after I open the application do a specific work.
I am not sure what I suppose to do.Should I create an AsyncTask in onCreate method of my main activity or a thread? Or should i do something completely different?
Upvotes: 0
Views: 2153
Reputation: 20325
Your question is a combined question asking how (way) to perform a task as well as how to schedule it.
Upvotes: 1
Reputation: 38168
You could use a Handler :
new Handler().postDelayed(new Runnable() { public void run() {
//your delayed action here, on UI Thread if needed
}
}, 1000 * 60 * 5 );
Regards, Stéphane
Upvotes: 0
Reputation: 15118
This may help: http://developer.android.com/reference/android/app/AlarmManager.html
Upvotes: 2