1

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?

propoLis
  • 1,229
  • 1
  • 14
  • 48
  • 1
    you can change device orientation before open contact app: https://stackoverflow.com/questions/9718317/control-default-auto-rotate-screen-in-my-application and then return device on old orientation after adding contact – javadroid Jan 13 '20 at 08:08
  • your welcome, hope it help you. you can using upvote button if comment was helpful – javadroid Jan 13 '20 at 08:29
  • Thank you very much but it is not working :( – propoLis Jan 13 '20 at 08:48
  • did you change system system orientation as well? when open contact app check the notification: is rotation set? – javadroid Jan 13 '20 at 08:50
  • yeap I guess that because of this page is not application page, it is not working. – propoLis Jan 13 '20 at 09:22
  • 1
    also check this topic: https://stackoverflow.com/questions/14587085/how-can-i-globally-force-screen-orientation-in-android – javadroid Jan 13 '20 at 09:45
  • your welcome. posted as answer, you can use upvote and mark as answer. have fun. – javadroid Jan 13 '20 at 18:13

1 Answers1

0

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

javadroid
  • 1,421
  • 2
  • 19
  • 43