i have an activity and on startup of the activity i need to change the orientation in lanscape and then later on i want to handle both orientation changes as user rotates de
I'm not clear about your requirement. If you don't mind restarting your activity, you can just skip overriding onConfigurationChanged
. System will handle Orientation changes for you. In case you don't want it to be restarted on orientation changes, just mention
, and override onConfigurationChanged
and call setContentView()
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentview(R.layout.activity_hls);
initializeViews();//here you can initialize all your memberVariables using findViewbyID()
}