In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly analyzes the relevant knowledge points of the useful habits in Android development, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about the useful habits in Android development.
1. All classes define TAG for ease of debugging. Log is recorded in all methods (or at the beginning of critical steps).
Class TestService extends SuperClass {private static final String TAG = "text.TestService"; / / some code... Private void method1 () {Log.i (TAG, "method1"); / / some code... }}
2. In Activity, many controls have events such as click, and it seems messy to register each control. You can let Activity implement OnXXXXListener. In the onXXX () method, the process is unified.
Class MyActivity extends Activity implements OnClickListener {/ / some code public void onCreate (Bundle savedInstanceState) {initComponent (); registerListenr ();} private void initComponent () {mTextView = (TextView) findViewById (R.id.id1); mTextView2 = (TextView) findViewById (R.id.id2); / / some code} private void registerListener () {mTextView.setOnClickListener (this); mTextView.setOnClickListener (this) } private boolean onClick (View v...) {switch (v.getId ()) {case R.id.id1: break; case R.id.id2: break; default: Log.... }}}
3. Reuse layout layout files by include as far as possible. Easy to manage, save time and keep the code simple.
4. Use style to uniformly set the properties of the control. In order to avoid inconsistent style, but also save code.
5. No mixing is used before the official package is released. Otherwise, you will not be able to view the log after testing the bug. You can only see a.b.c.
About "what are the useful habits in Android development" here, more relevant content can be searched for previous articles, hope to help you answer questions, please support the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.