Android about finish (), ondestory (), system.exit (0), oncheckedchanged (radiogroup arg0, int Checkid) Summary
Source: Internet
Author: User
<span id="Label3"></p><p><p>first, rewrite the parent class, finish (), Function.</p></p><pre><pre><span style="color: #000000;"> @Override </span>public<span style="color: #0000ff;"></span><span style="color: #0000ff;">void</span> <span style="color: #000000;"> finish () { </span><span style="color: #008000;">//</span> <span style="color: #008000;">Other actions before end, mobile phone written here The "back" key is both valid</span> <span style="color: #008000;">//</span> <span style="color: #008000;">using the keyword super to call the finish () function of the parent class</span> <span style="color: #0000ff;">Super</span><span style="color: #000000;">. Finish (); </span> <span style="color: #008000;">//</span> <span style="color: #008000;">End Animation</span> <span style="color: #000000;"> overridependingtransition (r.anim.push_left_0, r.anim.push_left_1); }</span></pre></pre><p><p>The advantage of this writing is that if you use the finish () function, the phone "back" key is Valid. If you want to save some important values, or you can make a decision to replicate the finish () Function.<br>The finish function simply exits the current activity, but does not release his resources. The Android system itself decides when to release the application from Memory. When the system does not have available memory, it will release some of the apps by Priority.</p></p><p><p>second, activity.ondestory ()<br>The system destroys the space occupied by the instance of the activity in Memory.<br>During the activity life cycle, the Ondestory () method is the last step of his life, and the resource space is Recycled. When you re-enter this activity, you must recreate and execute the OnCreate () method.</p></p><p><p>three, System.exit (0)<br>This is the exit of the entire application, which is for the entire Application. Close the entire program process directly to Exit.</p></p><p><p>Iv. oncheckedchanged (radiogroup arg0, int checkid);</p></p><pre><pre><span style="color: #000000;"> @Override </span><span style="color: #008000;">//</span> <span style="color: #008000;"> radiogroup listening</span> public <span style="color: #0000ff;"></span><span style="color: #0000ff;">void</span><span style="color: #0000ff;">int</span> <span style="color: #000000;"> Checkid) { arg0.check (checkid); }</span></pre></pre><p><p>This is an interface implemented by the Radiogroup control Listener. But if you need to use this function, you can also apply it flexibly.<br>1, call oncheckedchanged (radiogroup arg0, int checkid);<br>function, you need to find the ID of the Radiogroup and find the ID of the Radiobutton. These values are assigned IN.<br>Example:</p></p><pre><pre>Radiogroup Radiogroup =<span style="color: #000000;"></span>=<span style="color: #000000;"> (RadioButton) findviewbyid (r.id.radio); oncheckedchanged (radiogroup, radio);</span></pre></pre><p><p>2, Arg0.check (checkid);</p></p><p><p>This function is to automatically help you choose Radiobutton. As long as the radiogroup, RadioButton ID passed in, to achieve anything.</p></p><p><p></p></p><p><p>V. Common TextView find the ID bound control and display the text shortcut method</p></p><pre><pre><span style="color: #0000ff;"></span> public <span style="color: #0000ff;">void</span> settextviewidandshowtext (<span style="color: #0000ff;">int</span> <span style="color: #000000;"> nrid, String showtext) { </span><span style="color: #0000ff;">try</span> <span style="color: #000000;"> { </span>=<span style="color: #000000;"> (TextView) findviewbyid (Rid); </span> <span style="color: #0000ff;">if</span> <span style="color: #0000ff;">NULL</span> <span style="color: #0000ff;">null</span> ? ""<span style="color: #000000;"> : txt); </span> <span style="color: #0000ff;">Catch</span> <span style="color: #000000;">(classcastexception Fe) { }}</span></pre></pre><p><p></p></p><p><p>Android about finish (), ondestory (), system.exit (0), oncheckedchanged (radiogroup arg0, int Checkid) Summary</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