AsyncTaskを開始しているため、回転を禁止したいアクティビティの1つがあり、画面の回転によって再開されます。
このアクティビティを「ユーザーが怒って電話を振っている場合でも画面を回転させないでください」と伝える方法はありますか?
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
                AsyncTaskを開始しているため、回転を禁止したいアクティビティの1つがあり、画面の回転によって再開されます。
このアクティビティを「ユーザーが怒って電話を振っている場合でも画面を回転させないでください」と伝える方法はありますか?
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
                回答:
追加
android:screenOrientation="portrait" 
または
 android:screenOrientation="landscape" 
<activity>要素/マニフェストにSとすれば完了です。
あなたは、自動回転画面を防ぐために、以下のロジックに従うことができながら、あなたがAsyncTask実行されています。
getRequestedOrientation()ます。setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR)ます。AsyncTask。AsyncTask使用して、前のオリエンテーションの状態を復元setRequestedOrientation(oldOrientation)。Activity内のプロパティに(UIスレッドで実行される)アクセスする方法はいくつかあることに注意してくださいAsyncTask。をAsyncTask内部クラスとして実装することもHandler、Activiyクラスを突くメッセージを使用することもできます。
これを行うことがわかった最も簡単な方法は、
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
onCreate内、直後
setContentView(R.layout.activity_main);
そう...
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
              AndroidManifestに入るのではなく、次のようにすることができます。
screenOrientation = getResources().getConfiguration().orientation;
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
... AsyncTask
screenOrientation = getResources().getConfiguration().orientation;
@Override
protected void onPostExecute(String things) {
    context.setRequestedOrientation(PlayListFragment.screenOrientation);
    or 
    context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
}
ここでの唯一の欠点は、APIレベル18以上が必要なことです。これが基本的に槍の先です。
Activity.java
@Override     
 public void onConfigurationChanged(Configuration newConfig) {       
        try {     
            super.onConfigurationChanged(newConfig);      
            if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {      
                // land      
            } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {      
               // port       
            }    
        } catch (Exception ex) {       
     }   
AndroidManifest.xml
 <application android:icon="@drawable/icon" android:label="@string/app_name">
  <activity android:name="QRCodeActivity" android:label="@string/app_name"
  android:screenOrientation="landscape" >
   <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
   </intent-filter>
  </activity>
 </application>
              AndroidManifest.xmlのACTIVITYの次の属性で十分です。
android:configChanges="orientation"
したがって、完全なアクティビティノードは次のようになります。
<activity android:name="Activity1"
          android:icon="@drawable/icon"
          android:label="App Name"
          android:excludeFromRecents="true"
          android:configChanges="orientation">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>
              以下をAndroidManifest.xmlに追加します
[アプリ> src>メイン> AndroidManifest.xml]
<activity android:name=".MainActivity"
          android:configChanges="orientation"
          android:screenOrientation="portrait"/>
例:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx.zzzzzz.yyyyy">
   <uses-permission android:name="A-PERMISSION" />
   <application>
      <activity android:name=".MainActivity"
                android:screenOrientation="portrait"
                android:configChanges="orientation">
      </activity>
   </application>
</manifest>
              Android Developer Tools(ADT)とEclipse を使用している場合は、AndroidManifest.xml-> Applicationタブ->に移動して、アクティビティを選択できます。最後に、好みの向きを選択します。多くのオプションから1つを選択できます。
あなたはこの方法を試すことができます
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.itclanbd.spaceusers">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".Login_Activity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
              AsyncTaskLoaderを使用すると、画面の回転を防ぐよりもアプリを構築するのに優れた方法であるAsyncTaskを使用する代わりに、アクティビティが変更された場合でもデータを安全に保つことができます。
"portrait"AndroidManifest.xmlファイルのユーザーは、良い解決策のように思えるかもしれません。ただし、特定のデバイス(横向きで最適に動作するデバイス)が縦向きになり、適切な向きになりません。最新のAndroidバージョンでは、エラーが発生します。だから私の提案はそれを使用する方が良い"nosensor"です。
<activity
        ...
        ...
        android:screenOrientation="nosensor">