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);
精彩评论