<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Library &#187; solution</title>
	<atom:link href="http://www.ucosoft.com/tag/solution/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ucosoft.com</link>
	<description>Free Source Code and Program Tips</description>
	<lastBuildDate>Mon, 19 Jul 2010 04:51:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Android if they had to switch screen solution (reproduced)</title>
		<link>http://www.ucosoft.com/android-switch-screen-solution-reproduced-2.html</link>
		<comments>http://www.ucosoft.com/android-switch-screen-solution-reproduced-2.html#comments</comments>
		<pubDate>Thu, 17 Dec 2009 22:22:28 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[reproduced]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/uncategorized/android-switch-screen-solution-reproduced-2.html</guid>
		<description><![CDATA[Original From: http://blog.sina.com.cn/s/blog_4ca975460100g5yj.html Android if they had to switch on the screen solution The time in the development of the game, some games are only horizontal screen play, so when placed in the erection of mobile phone, to keep the game screen is still horizontal screen. To achieve this requirement is very simple to configure]]></description>
			<content:encoded><![CDATA[<p>  Original From: http://blog.sina.com.cn/s/blog_4ca975460100g5yj.html </p>
</p>
<p>  Android if they had to switch on the screen solution </p>
<p>  The time in the development of the game, some games are only horizontal screen play, so when placed in the erection of mobile phone, to keep the game screen is still horizontal screen.  To achieve this requirement is very simple to configure in the AndroidManifest.xml inside look on it.  Add this line android: screenOrientation = &quot;landscape&quot;. </p>
<p>  For example, (landscape is a horizontal, portrait vertical): <br />  Java code </p>
<p>  &lt;? xml version = &quot;1.0&quot; encoding = &quot;utf-8&quot;?&gt; <br />  &lt;manifest xmlns: android = &quot;http://schemas.android.com/apk/res/android&quot; <br />  package = &quot;com.ray.linkit&quot; <br />  android: versionCode = &quot;1&quot; <br />  android: versionName = &quot;1.0&quot;&gt; <br />  &lt;application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;&gt; <br />  &lt;activity android: name = &quot;. Main&quot; <br />  android: label = &quot;@ string / app_name&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; <br />  &lt;intent-filter&gt; <br />  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt; <br />  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt; <br />  &lt;/ intent-filter&gt; <br />  &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. GamePlay&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. OptionView&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;/ application&gt; <br />  &lt;uses-sdk android:minSdkVersion=&quot;3&quot; /&gt; <br />  &lt;/ manifest&gt; </p>
<p>  &lt;? xml version = &quot;1.0&quot; encoding = &quot;utf-8&quot;?&gt; <br />  &lt;manifest xmlns: android = &quot;http://schemas.android.com/apk/res/android&quot; <br />  package = &quot;com.ray.linkit&quot; <br />  android: versionCode = &quot;1&quot; <br />  android: versionName = &quot;1.0&quot;&gt; <br />  &lt;application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;&gt; <br />  &lt;activity android: name = &quot;. Main&quot; <br />  android: label = &quot;@ string / app_name&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; <br />  &lt;intent-filter&gt; <br />  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt; <br />  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt; <br />  &lt;/ intent-filter&gt; <br />  &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. GamePlay&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. OptionView&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;/ application&gt; <br />  &lt;uses-sdk android:minSdkVersion=&quot;3&quot; /&gt; <br />  &lt;/ manifest&gt; </p>
<p>  In addition, android dynamic switching each time the screen will restart Activity, so it should be in the Activity prior to their destruction to save the state of current activity in the Activity, when re-Create load configuration, as carried out in the game will not be automatically restarted! </p>
<p>  Reprinted from: http://rayleung.javaeye.com/blog/426972 </p>
<p>  Answers Time :2009-01-18 18:04 <br />  When the screen when the screen becomes horizontal, the system will re-calls the current Activity&#39;s OnCreate method, you can put on your OnCreate the following methods to check the current in the direction of, then you can let your SetContentView to load a different Layout xml. </p>
<p>  if (this.getResources (). getConfiguration (). orientation == Configuration.ORIENTATION_LANDSCAPE) ( </p>
<p>  Log.i ( &quot;info&quot;, &quot;landscape&quot;); </p>
<p>  ) </p>
<p>  else if (this.getResources (). getConfiguration (). orientation == Configuration.ORIENTATION_PORTRAIT) ( </p>
<p>  Log.i ( &quot;info&quot;, &quot;portrait&quot;); </p>
<p>  ) </p>
<p>  When switching on the screen first need to add the configuration in the androidmanifest.xml <br />  android: configChanges = &quot;orientation | keyboardHidden | navigation <br />  So in the program. Activity will not be repeated call onCreate () <br />  Does not even call onPause.onResume. <br />  Will call a onConfigurationChanged (Configuration newConfig) <br />  This is the XML configuration option to join the premise. </p>
<p>  If you join the options on the premise. As stated above. Activity will be re-activated onCreate method </p>
<p>  According to your own needs to choose the configuration changes when the mechanism for handling such a better life. </p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/android" title="android" rel="tag">android</a>, <a href="http://www.ucosoft.com/tag/reproduced" title="reproduced" rel="tag">reproduced</a>, <a href="http://www.ucosoft.com/tag/screen" title="screen" rel="tag">screen</a>, <a href="http://www.ucosoft.com/tag/solution" title="solution" rel="tag">solution</a>, <a href="http://www.ucosoft.com/tag/switch" title="switch" rel="tag">switch</a></strong><br />

	<ul class="st-related-posts">
	<li><a href="http://www.ucosoft.com/android-actions-broadcastreceiver.html" title="Android: Actions for BroadcastReceiver (October 16, 2009)">Android: Actions for BroadcastReceiver</a> (0)</li>
	<li><a href="http://www.ucosoft.com/sending-email-user-interaction-android.html" title="Sending email without user interaction in Android (November 17, 2009)">Sending email without user interaction in Android</a> (0)</li>
	<li><a href="http://www.ucosoft.com/sending-email-user-interaction-android-2.html" title="Sending email without user interaction in Android (December 17, 2009)">Sending email without user interaction in Android</a> (0)</li>
	<li><a href="http://www.ucosoft.com/android-20.html" title="Everything you need to know about Android 2.0 (November 20, 2009)">Everything you need to know about Android 2.0</a> (0)</li>
	<li><a href="http://www.ucosoft.com/android-20-2.html" title="Everything you need to know about Android 2.0 (December 17, 2009)">Everything you need to know about Android 2.0</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-development-android-helloword-program.html" title="Eclipse Development Android, the first one HelloWord program (study 1) (November 22, 2009)">Eclipse Development Android, the first one HelloWord program (study 1)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-development-android-helloword-program-2.html" title="Eclipse Development Android, the first one HelloWord program (study 1) (December 17, 2009)">Eclipse Development Android, the first one HelloWord program (study 1)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-developed-android-tablelayout-study.html" title="Eclipse developed Android, TableLayout (study 4) (December 3, 2009)">Eclipse developed Android, TableLayout (study 4)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-developed-android-tablelayout-study-2.html" title="Eclipse developed Android, TableLayout (study 4) (December 18, 2009)">Eclipse developed Android, TableLayout (study 4)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-developed-android-relativelayout-study.html" title="Eclipse developed Android, RelativeLayout (study 3) (December 2, 2009)">Eclipse developed Android, RelativeLayout (study 3)</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/android-switch-screen-solution-reproduced-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android if they had to switch screen solution (reproduced)</title>
		<link>http://www.ucosoft.com/android-switch-screen-solution-reproduced.html</link>
		<comments>http://www.ucosoft.com/android-switch-screen-solution-reproduced.html#comments</comments>
		<pubDate>Sat, 28 Nov 2009 16:12:16 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[reproduced]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/uncategorized/android-switch-screen-solution-reproduced.html</guid>
		<description><![CDATA[Original From: http://blog.sina.com.cn/s/blog_4ca975460100g5yj.html Android if they had to switch on the screen solution The time in the development of the game, some games are only horizontal screen play, so when placed in the erection of mobile phone, to keep the game screen is still horizontal screen. To achieve this requirement is very simple to configure]]></description>
			<content:encoded><![CDATA[<p>  Original From: http://blog.sina.com.cn/s/blog_4ca975460100g5yj.html </p>
</p>
<p>  Android if they had to switch on the screen solution </p>
<p>  The time in the development of the game, some games are only horizontal screen play, so when placed in the erection of mobile phone, to keep the game screen is still horizontal screen.  To achieve this requirement is very simple to configure in the AndroidManifest.xml inside look on it.  Add this line android: screenOrientation = &quot;landscape&quot;. </p>
<p>  For example, (landscape is a horizontal, portrait vertical): <br />  Java code </p>
<p>  &lt;? xml version = &quot;1.0&quot; encoding = &quot;utf-8&quot;?&gt; <br />  &lt;manifest xmlns: android = &quot;http://schemas.android.com/apk/res/android&quot; <br />  package = &quot;com.ray.linkit&quot; <br />  android: versionCode = &quot;1&quot; <br />  android: versionName = &quot;1.0&quot;&gt; <br />  &lt;application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;&gt; <br />  &lt;activity android: name = &quot;. Main&quot; <br />  android: label = &quot;@ string / app_name&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; <br />  &lt;intent-filter&gt; <br />  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt; <br />  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt; <br />  &lt;/ intent-filter&gt; <br />  &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. GamePlay&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. OptionView&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;/ application&gt; <br />  &lt;uses-sdk android:minSdkVersion=&quot;3&quot; /&gt; <br />  &lt;/ manifest&gt; </p>
<p>  &lt;? xml version = &quot;1.0&quot; encoding = &quot;utf-8&quot;?&gt; <br />  &lt;manifest xmlns: android = &quot;http://schemas.android.com/apk/res/android&quot; <br />  package = &quot;com.ray.linkit&quot; <br />  android: versionCode = &quot;1&quot; <br />  android: versionName = &quot;1.0&quot;&gt; <br />  &lt;application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;&gt; <br />  &lt;activity android: name = &quot;. Main&quot; <br />  android: label = &quot;@ string / app_name&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; <br />  &lt;intent-filter&gt; <br />  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt; <br />  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt; <br />  &lt;/ intent-filter&gt; <br />  &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. GamePlay&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;activity android: name = &quot;. OptionView&quot; <br />  android: screenOrientation = &quot;portrait&quot;&gt; &lt;/ activity&gt; <br />  &lt;/ application&gt; <br />  &lt;uses-sdk android:minSdkVersion=&quot;3&quot; /&gt; <br />  &lt;/ manifest&gt; </p>
<p>  In addition, android dynamic switching each time the screen will restart Activity, so it should be in the Activity prior to their destruction to save the state of current activity in the Activity, when re-Create load configuration, as carried out in the game will not be automatically restarted! </p>
<p>  Reprinted from: http://rayleung.javaeye.com/blog/426972 </p>
<p>  Answers Time :2009-01-18 18:04 <br />  When the screen when the screen becomes horizontal, the system will re-calls the current Activity&#39;s OnCreate method, you can put on your OnCreate the following methods to check the current in the direction of, then you can let your SetContentView to load a different Layout xml. </p>
<p>  if (this.getResources (). getConfiguration (). orientation == Configuration.ORIENTATION_LANDSCAPE) ( </p>
<p>  Log.i ( &quot;info&quot;, &quot;landscape&quot;); </p>
<p>  ) </p>
<p>  else if (this.getResources (). getConfiguration (). orientation == Configuration.ORIENTATION_PORTRAIT) ( </p>
<p>  Log.i ( &quot;info&quot;, &quot;portrait&quot;); </p>
<p>  ) </p>
<p>  When switching on the screen first need to add the configuration in the androidmanifest.xml <br />  android: configChanges = &quot;orientation | keyboardHidden | navigation <br />  So in the program. Activity will not be repeated call onCreate () <br />  Does not even call onPause.onResume. <br />  Will call a onConfigurationChanged (Configuration newConfig) <br />  This is the XML configuration option to join the premise. </p>
<p>  If you join the options on the premise. As stated above. Activity will be re-activated onCreate method </p>
<p>  According to your own needs to choose the configuration changes when the mechanism for handling such a better life. </p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/android" title="android" rel="tag">android</a>, <a href="http://www.ucosoft.com/tag/reproduced" title="reproduced" rel="tag">reproduced</a>, <a href="http://www.ucosoft.com/tag/screen" title="screen" rel="tag">screen</a>, <a href="http://www.ucosoft.com/tag/solution" title="solution" rel="tag">solution</a>, <a href="http://www.ucosoft.com/tag/switch" title="switch" rel="tag">switch</a></strong><br />

	<ul class="st-related-posts">
	<li><a href="http://www.ucosoft.com/android-actions-broadcastreceiver.html" title="Android: Actions for BroadcastReceiver (October 16, 2009)">Android: Actions for BroadcastReceiver</a> (0)</li>
	<li><a href="http://www.ucosoft.com/sending-email-user-interaction-android.html" title="Sending email without user interaction in Android (November 17, 2009)">Sending email without user interaction in Android</a> (0)</li>
	<li><a href="http://www.ucosoft.com/sending-email-user-interaction-android-2.html" title="Sending email without user interaction in Android (December 17, 2009)">Sending email without user interaction in Android</a> (0)</li>
	<li><a href="http://www.ucosoft.com/android-20.html" title="Everything you need to know about Android 2.0 (November 20, 2009)">Everything you need to know about Android 2.0</a> (0)</li>
	<li><a href="http://www.ucosoft.com/android-20-2.html" title="Everything you need to know about Android 2.0 (December 17, 2009)">Everything you need to know about Android 2.0</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-development-android-helloword-program.html" title="Eclipse Development Android, the first one HelloWord program (study 1) (November 22, 2009)">Eclipse Development Android, the first one HelloWord program (study 1)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-development-android-helloword-program-2.html" title="Eclipse Development Android, the first one HelloWord program (study 1) (December 17, 2009)">Eclipse Development Android, the first one HelloWord program (study 1)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-developed-android-tablelayout-study.html" title="Eclipse developed Android, TableLayout (study 4) (December 3, 2009)">Eclipse developed Android, TableLayout (study 4)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-developed-android-tablelayout-study-2.html" title="Eclipse developed Android, TableLayout (study 4) (December 18, 2009)">Eclipse developed Android, TableLayout (study 4)</a> (0)</li>
	<li><a href="http://www.ucosoft.com/eclipse-developed-android-relativelayout-study.html" title="Eclipse developed Android, RelativeLayout (study 3) (December 2, 2009)">Eclipse developed Android, RelativeLayout (study 3)</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/android-switch-screen-solution-reproduced.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
