<span id="Label3"></p><p><p><span style="font-size:18px">Nineth Lesson for Joshui teacher</span></p></p><p><p><span style="font-size:18px">one, Save the state of the activity</span></p></p><p><p><span style="font-size:18px">When the phone horizontal screen, the system calls destroys and recreates, if not save the activity state, will lose the User's Data.</span></p></p><p><p><span style="font-size:18px"><br></span></p></p><p><p><span style="font-size:18px">The following two pieces of code implement the state of saving activity:</span></p></p><pre name="code" class="java" style="font-size:18px;"><pre name="code" class="java" style="font-size:18px;">Private EditText txt = null; There is an input box in the layout that is referenced to txtprivate static final string content = "content"; txt= (EditText) findviewbyid (r.id.txt);p rotected void Onsaveinstancestate (Bundle Outstate) //overwrite onsaveinstancestate method, This method is called automatically before program pause or destroy. { Super.onsaveinstancestate (outstate); String content = Txt.gettext (). toString (); outstate.putstring (content,content); The characters entered in the input box are saved in the content, and then stored in the Bundle.</pre></pre><span style="font-size:18px"><span style="font-size:18px">then review the familiar OnCreate methods that are not more familiar:</span></span><br><pre name="code" class="java" style="font-size:18px;"><pre name="code" class="java" style="font-size:18px;">public void OnCreate (bundle Savedinstancestate)//you can see that the bundle parameter here and the parameter in Onsaveinstancestate is a parameter, so just take the bundle out here, The purpose of saving the activity state is achieved!! {super.oncreate (savedinstancestate); Setcontentview (r.layout.main); if (null!=savedinstancestate&& Savedinstancestate.conainskey (content))//if The bundle is not empty, and the contents of CONTENTR in the bundle are not empty {txt.settext ( Savedinstancestate.getstring (CONTENT));//take The value out and put it back in the input box}</pre></pre><br><span style="font-size:24px"><span style="font-size:24px"><strong>two, Android:theme</strong></span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.dialog": activity is displayed as dialog box mode</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.notitlebar": do not display the application title bar</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.notitlebar.fullscreen": does not display the application title bar and full screen</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.light": white background</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.light.notitlebar": white background with no title bar</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.light.notitlebar.fullscreen": white background, no title bar, fullscreen</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.black": black background</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.black.notitlebar": black background with no title bar</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.black.notitlebar.fullscreen": Black background, no title bar, fullscreen</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.wallpaper": using the system desktop for the application background</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.wallpaper.notitlebar": application background with System desktop and no title bar</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.wallpaper.notitlebar.fullscreen": application background with system desktop, no title bar, fullscreen</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.translucent: Transparent Background</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.translucent.notitlebar": Transparent background with no caption</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.translucent.notitlebar.fullscreen": Transparent background with no caption, fullscreen</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.panel": panel style display</span></span><br><span style="font-size:18px"><span style="font-size:18px">android:theme= "@android: style/theme.light.panel": flat style display</span></span><br><br> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>Android Learning note (6) Activity Advanced +android:theme Learning</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service