Search code examples
androidandroid-intentorientationcontactsandroid-contacts

How to set orientation to intent.putExtra?


I have add new contact button and when I press this button, android is opening system new contact page.

Opening page is android system page, not inside my app page.

MyActivity(){

 addToContactView.setOnClickListener(view -> {
   Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI), 1);
   //intent.putExtra("orientation", "portrait"); //like this
   startActivityForResult(intent);
   });
 }

Manifest:

<activity
  android:name=".MyActivity"
  android:configChanges="locale"
  android:screenOrientation="portrait"/>

I set portrait screen orientation at MyActivity. But android system new contact page is opening landscape mode.

Can orientation be set into intent?


Solution

  • You must globaly change the orientation before opening contact app. see this topic: How can I globally force screen orientation in Android?