Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smooth transition between activities without black screen

I use activity with ImageView, and by click on button it switches to activity with VideoWiew and plays movie, the movies first frame is the image on previous activity. I disabled animation between activity by using

Intent intent = new Intent(ImageClass.this, MovieClass.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);

but it still flashes black screen between them, how can i disable this?

like image 470
DanM Avatar asked Apr 10 '12 11:04

DanM


1 Answers

One of the simplest way is to move all the expensive (time-consuming) processing from your activity's onCreate and onStart method to onResume mthod. By this, your newly launched activity will be visible right after its launched but then will take a little extra to make it available for user to interact. Further, I would suggest you to move all the heavy lifting in AsyncTask for smoother UI experience.

like image 200
waqaslam Avatar answered Nov 06 '22 23:11

waqaslam