Transition after Thread.sleep()?



I'm programming an application with an initial logo activity. It have to be displayed for 1 second and then launch the main activity using a custom transition.


The problem is that the logo activity is displayed for 1 second, but the animation is quite always the standard and only rarely the custom animation I made.


This is the code in logoActivity.class :



Thread thread;
i = new Intent(this, mainActivity.class);
thread= new Thread(){
@Override
public void run(){
try {
synchronized(this){
Thread.sleep(1000);
}
}
catch(InterruptedException ex){
Log.d("Event Loop", "Exception: " + ex.toString());
}
startActivity(i);
overridePendingTransition(R.anim.anim_out, R.anim.anim_in);
finish();
}
};


this is the code in anim_out.xml :



<?xml version="1.0" encoding="utf-8"?>

<translate
xmlns:android="http://ift.tt/nIICcg"
android:duration="@android:integer/config_shortAnimTime"
android:fromXDelta="0%p"
android:toXDelta="100%p"></translate>


and this is the code in anim_in.xml:



<?xml version="1.0" encoding="utf-8"?>

<translate
xmlns:android="http://ift.tt/nIICcg"
android:duration="@android:integer/config_shortAnimTime"
android:fromXDelta="-100%p"
android:toXDelta="0%p"></translate>


I use those animations to set the custom transition from mainActivity and secondActivity too, and it works perfectly.


Please, help me solving this problem!


No comments:

Post a Comment