Rajith Rajan
Rajith Rajan

Reputation: 121

screen mode in portrait the orientation issue in samsung mobile

I'm developing custom camera application.I forced to set the screen-mode is Portrait.But come to samsung mobile the orientation of screen problem.What will do to set up application using portrait mode in samsung mobile

Upvotes: 0

Views: 148

Answers (1)

JiTHiN
JiTHiN

Reputation: 6588

Try the following: In your activity,

   /** Forces the application to run in portrait mode */
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

In your manifest.xml

  <activity
        android:name="yourActivityName"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:screenOrientation="portrait" >
  </activity>

Also, if your application runs on v2.2 or above you can rotate camera orientation to portrait using camera.setDisplayOrientation(90).

Upvotes: 1

Related Questions