Reputation: 75
I have a function time() in my openGLActivity class. The openGLActivity is open by my Main activtiy. I've tried calling super.onPause() then super.onStop(); and i just get errors. This time function is called inside of my GLrenderer class. Can an activity cloe itself after a time limit?
timer(){
t+=1;
if(t==1000){
finish();
}
}
Upvotes: 0
Views: 63
Reputation: 8826
If I didn't misunderstand your question, you can easily do that with handler. This should close the activity. Use it onCreate()
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
OpenGLActivity.this.finish();
}
}, 3000);
Upvotes: 1
Reputation: 1742
Activities in the system are managed as an activity stack. It means that if Activity1 calls Acitivity2 by
startActivity(Intent i)
Activity2 remains alive until you go back since the Activity1.
Upvotes: 0