using both layout-land and onConfigurationChanged()

Posted by joe on Stack Overflow See other posts from Stack Overflow or by joe
Published on 2012-08-31T05:48:59Z Indexed on 2012/09/01 3:38 UTC
Read the original article Hit count: 129

I just want to change Layout when the device has been rotated. but I've found that onConfigurationChanged() must call onCreate() again using setContentView with separated layout named of *_land.xml

if(getActivity().getWindowManager().getDefaultDisplay().
getRotation() == Surface.ROTATION_0)
view = inflater.inflate(R.layout.fragment_layout, null);
else view = inflater.inflate(R.layout.fragment_layout_land, null);

Project is too big and there are many codes to fix If onCreate again without finish().

I'd like somebody help this.

Thank you.

-> onConfigurationChanged concept is keep layout I think

© Stack Overflow or respective owner

Related posts about android

Related posts about rotation