0

I am working on Activity1 given landscape in the manifest.

Now, I want to launch web browser in portrait from Activity1 and keep it in Activity1 landscape.

If it is possible, how can I do that?

This is my code:

Activity1.java

Intent intent = new Intent(Intent.ACTION_VIEW, uri);        
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
hitonamino
  • 23
  • 1
  • 7
  • I want to launch web browser in portrait from Activity1 and keep it in Activity1 landscape? Means you want to put web browser inside activity view? or after launching web browser you want to make Activity1 landscape? – Abhishek Sep 07 '17 at 09:07
  • It means after launching web browser I want to **keep** Activity1 landscape. – hitonamino Sep 07 '17 at 09:37
  • Its easy. After your code just call setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); it will force your activity in landscape mode. – Abhishek Sep 07 '17 at 09:39

1 Answers1

0

you can't determinate orientation for not-yours-activity (app) with intent. if it supports landscape then it opens in landscape. Maybe its better to use own WebView in separated Activity with forced portrait orientation?

snachmsm
  • 17,866
  • 3
  • 32
  • 74
  • I see. I will try to use own WebView in separated Activity with forced portrait orientation!! Thank you very much for your suggestion.+* – hitonamino Sep 07 '17 at 09:35