I have Made a Simple Beginner Application with the help of Drawables and Intent. The Idea is making four activities and using Thread move from one to other Activities and when it reaches to the last activity, i want to close the Application Automatically, popping up a toast as "BYE" or something else. If it is possible by Intent or any other way do guide me.
Code of my Last Activity is below, but it loops to the Last activity to Infinity:
package mj.manan.thisisit;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class ScreenLast extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_screenlast);
Thread t1 = new Thread(){
public void run(){
try {
Thread.sleep(2000);
finish();
} catch (InterruptedException e) {
// Auto-generated catch block
e.printStackTrace();
}finally{
Intent innt = new Intent(ScreenLast.this,ScreenLast.class);
innt.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(innt);
ScreenLast.this.finish();
}
}
};
t1.start();
}
}