android class calling orientation from another class -


i want call screen orientation 1 activity compress code , make easier call other functions.

public class activity2 extends activity{       public void orientation(){     requestwindowfeature(window.feature_no_title);     getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);     setrequestedorientation(activityinfo.screen_orientation_landscape);   } } 

the main application call orientation class:

public class main extends activity {   final activity2 summon = new activity2();   public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     summon.orientation();     setcontentview(r.layout.main);   } } 

can done? sorry bad english, second language.

in oncreate() of activities, setting landscape orientation

this.setrequestedorientation(activityinfo.screen_orientation_landscape);

and portrait orientation

`this.setrequestedorientation(activityinfo.screen_orientation_portrait);'

and let android manage activities , use startactivity() method start activity 1 activity. every activity have orientation per configuration.

regards, aqif hamid


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -