I am developing and android application in that I want to start another application(my second application). I am doing the following code
Intent i= new Intent();
i.setComponent(new ComponentName("my second app package","my class name"));
startActivity(i);
It is working fine.
I want to hide the second application after 3 or 5 seconds for that I am following the below code
Timer t=new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
Intent i = new Intent("first app package","first app class name" );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
}, 5000);
But this code is not working as I expected only for my second application. But other applications are working fine. Instead thread I also tried Handler, alaram manager also no sucess. Please any one help me in this.
Is I want to do any code change in my second application or what is the problem with my code?
Thanks