If I understand your problem correctly, here is what you can do: create an empty Activity (without setting its contents) as follows:
public class EmptyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
and then you do all the other Activities continue with EmptyActivity . Thus, you just need to implement the screen orientation logic once.
source share