How i can lock Orientation of a device by code
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3611457/android-temporarily-disable-orientation-changes-in-an-activity">Android: Temporarily disable orientation changes in an Activity</a>  </p>
</blockquote>



<p>Me testing in Samsung Galaxy tab. In that i have made two layout folder for both ORIENTATION_LANDSCAPE and ORIENTATION_PORTRAIT with specific layout xml in it.<br>
In that layout i have a button and on clicking it start a progress dialog (doing some stuff using AsyncTask, after that going to new intent)<br>
But when the device is rotated when the progress dialog is working, that dialog and AsyncTask stop and new layout is loaded. If i understood correctly, I think the <code>onCreate</code> is called when device is rotated
How i can block calling onCreate while rotating device when My AsyncTask start?<br>
<strong>IN SHOT</strong><br>
How i can lock Orientation of a device by code, for example Lock Orientation on a button click<br>
Thank you </p>
