开发者

How to set Orientation Lock In Async Task during runtime

My app shows diffent views for landscape and portrait for that I defined 2 views one in 开发者_开发百科layout and one in layout-land. After clicking some button I will start one async task, which will fetch some data from service and bind it to my UI, which is different in landscape and portrait. My problem is as soon as I click the button (which starts async task with some progress bar), If i rotate the screen the app will crash. My design won't support overriding onRetainConfigChanges(), as I have multiple async tasks, each will effect my UI in diff way.

My Idea is "Is there is a way to lock orientation in onPreExcecute and leave it in on post Execute()". Any Idea Plz help me. Sorry for my english.


onPreExecute: activity.setRequestedOrientation(getActivity().getResources().getConfiguration().orientation)

onPostExecute activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜