The following code is provided in packages/apps/phone/src/COM/Android/phone/gsmumtscallforwardoptions. Java of Android source.
Package COM. android. phone; // some codes are omitted: public class extends {// some codes are omitted: Private Static final string button_cfu_key = "button_cfu_key"; Private Static final string button_cfb_key = "button_cfb_key "; private Static final string button_cfnry_key = "button_cfnry_key"; Private Static final string button_cfnrc_key = "button_cfnrc_key"; private callforwa Rdeditpreference mbuttoncfu; // note1: the declared order private parameter mbuttoncfb; private parameter mbuttoncfnry; private parameter mbuttoncfnrc; @ override protected void oncreate (bundle icicle) {super. oncreate (icicle); // omitting some code mbuttoncfu = (callforwardeditpreference) prefset. findpreference (button_cfu_key); // note2: Stick to the previous order. Mbuttoncfb = (callforwardeditpreference) prefset. findpreference (button_cfb_key); mbuttoncfnry = (callforwardeditpreference) prefset. findpreference (button_cfnry_key); mbuttoncfnrc = (callforwardeditpreference) prefset. findpreference (button_cfnrc_key); mbuttoncfu. setparentactivity (this, mbuttoncfu. reason); // note3: Put the same processing together to form a strong analogy mbuttoncfb. setparentactivity (this, mbuttoncfb. reason); // separate different processing blocks. Mbuttoncfnry. setparentactivity (this, mbuttoncfnry. reason); mbuttoncfnrc. setparentactivity (this, mbuttoncfnrc. reason); mpreferences. add (mbuttoncfu); mpreferences. add (mbuttoncfb); mpreferences. add (mbuttoncfnry); mpreferences. add (mbuttoncfnrc);} // some code is omitted}
The Code has the following features:
- There is a certain declaration order during the declaration.
- This order is adhered to during use.
- Put the same processing together to highlight Functional consistency.
- Different Processing Sections are separated, indicating that the logic is different. (In some scenarios, it can represent a sequential relationship)