Android animate to singleTask

*爱你&永不变心* 提交于 2019-12-12 19:04:00

问题


I am making an app with multiple tabs (without the tabview). One takes a long time to load so I made a singletask of it. Now it only has to load once what saves a lot of time.

Only in the onCreate I define the transition I want: overridePendingTransition(R.anim.fade_in, R.anim.fade_out);

Only the onCreate is never called again, i tried to put it on top of the onResume and onStart but that didn't helped either.

The problem now is that the animation becomes the default animation which differs a lot on different devices.

Does anyone know a way to change this? I tried calling it after the startActivity method with no succes either.

If anyone has a solution to stop the loadtime then it is also okey. The load time goes to making multiple listview in a swipeview (jason fry). This listview contains around 90 imageviews each, most of them are the same image.

Thanks for any thoughts, ideas or solutions in advance.


回答1:


You should override the finish() method of your activity. In the overridden method, after calling super.finish() - call overridePendingTransition() with your favorite transition (if you want no transition - define a transition that does nothing, with duration 0).




回答2:


You could try calling that in the onNewIntent() method. That should be called when you try to launch the Activity a second time.



来源:https://stackoverflow.com/questions/9231210/android-animate-to-singletask

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!