I would like to clarify the use of view animation, rights, etc. in Android.
I usually create an animation without any tread objects - right in my Activity / Fagment / ViewClass:
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(100);
mView.setAnimation(alphaAnimation);
alphaAnimation.start();
I understand this as an animation running in the main user interface thread.
But if I create an animation inside the workflow, will this be the usual way?
public void onClick(View v) {
new Thread(new Runnable() {
public void run() {
final AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(100);
mView.post(new Runnable() {
public void run() {
mView.setAnimation(alphaAnimation);
alphaAnimation.start();
}
});
}
}).start();
}
source
share