rotation - how do i enable auto rotate again in android after triggering the on click from button? -


i create sample apps triger fullscreen button , auto rotatation enabled triger fullscreen, after using auto rotate , if use button triger orientation change, after click button activity canot auto rotation again changing orientation, button can changed modes, auto rotation cannot used anymore. how fixed this?

is normal?

button resize

public void clickresize(view view) {     setrequestedorientation(activityinfo.screen_orientation_portrait); } 

button fullscreen

public void clickfullscreen(view view) {     setrequestedorientation(activityinfo.screen_orientation_landscape); } 

methods addflags, clearflags , configurationchanged()

private void onfullscreen() {         window.addflags(windowmanager.layoutparams.flag_fullscreen);         window.clearflags(windowmanager.layoutparams.flag_force_not_fullscreen);     }  private void offfullscreen() {     window.addflags(windowmanager.layoutparams.flag_force_not_fullscreen);     window.clearflags(windowmanager.layoutparams.flag_fullscreen); }  public void onconfigurationchanged(configuration newconfig) {     super.onconfigurationchanged(newconfig);      if (newconfig.orientation == configuration.orientation_landscape) {         onfullscreen(); }                    } else if (newconfig.orientation == configuration.orientation_portrait) {             offfullscreen();     }        } 

i have faced same problem , resolved follows :

set setrequestedorientation(activityinfo.screen_orientation_unspecified) after rotation code:

from :

public void clickresize(view view) { setrequestedorientation(activityinfo.screen_orientation_portrait);} 

to :

public void clickresize(view view) { setrequestedorientation(activityinfo.screen_orientation_portrait); setrequestedorientation(activityinfo.screen_orientation_unspecified)} 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -