Android Development Issue Notes

Source: Internet
Author: User
Tags response code
<span id="Label3"></p><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;">1, Toolbar problem: Minimum version 15, must use support, in order to use Toolbar,toobar is 5.0 introduced<br>2, bottomtab: this with tablayout solved</p></p><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;">3, the backend API is best to use a mature framework to do,<span style="color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;">RESTful django-rest-framework, for example, can simplify the IT infrastructure and reuse mature Designs:<br>4. finally, The tablayout+viewpager+placefragment solves the problem with the Android studio generation Wizard.<br>5, the best practice of the official website is worth reference<br>6, using Okhttp to do network access<br>7, using Picasso to do picture loading<br>8, the use of Expandlistview do according:<br>Http://www.cnblogs.com/eyu8874521/archive/2012/08/16/2642605.html<br>http://my.oschina.net/amigos/blog/62614<br>9, non-dynamic Adjustment of information as far as possible in the layout to indicate<br>10, code copy+ Careless Pit Dead: The problem should be positioned First.<br>11, Android UI Design idea is not to do a good job of the UI data, but by the data structure of the UI structure, UI and data through the adapter structure to match the BUILD. So in essence Android is not a Drag-and-drop interface design, but the official MCV structure, similar to the MVT architecture of the Web Page.<br>12, Android Design and development of the first pit: layout<br>13. The margin of the ListView subkey can be set with Devider<br>14, adjust the effect of mobile phone, faster than the simulator, tune code with the simulator, tracking than the real machine Convenient.<br>15, to try to lengthen the application code debugging time period, because the run time consumption is not short.<br>16, through the communication to improve the efficiency of the front and rear end of a method: the design of the domain model to have a special communication ventilation conference.<br>17, ANDROIDSDK Local Installation documentation, because the reason for referencing remote files, the availability is not very good.<br>18, The key design must have relevant party review steps, such as the data model, such as the mobile backend Api.<br>19, The ListView should not appear inconsistent layout of the listitem, which will lead to itemview reuse problems<br>20, button can be displayed in text, tag Value.<br>21, The final parameters passed to the Rxjava may require copy copy to ensure the multithreading read and write problems, generally only the UI main thread and background thread in the context of the need not<br>22, Resource Status list, this information can be found from the official API Guide:</span></p><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"></p></p><strong><strong>[html]</strong></strong>View Plain<span data-mod="popu_168"><span data-mod="popu_168">copy<span data-mod="popu_169"> print? <span class="tracking-ad" data-mod="popu_167"><span class="tracking-ad" data-mod="popu_170"></span></span> </span> </span></span> <ol class="dp-xml" start="1"> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">selector <span class="attribute">xmlns:android=<span class="attribute-value">"http://schemas.android.com/apk/res/android"; <span class="tag">></span> </span> </span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">item</span></span></li></li> <li class="alt"><li class="alt"><span class="attribute">android:color=<span class="attribute-value">"hex_color"</span></span></li></li> <li><li><span class="attribute">android:state_pressed=["true" | "false"]</span></li></li> <li class="alt"><li class="alt"><span class="attribute">android:state_focused=["true" | "false"]</span></li></li> <li><li><span class="attribute">android:state_selected=["true" | "false"]</span></li></li> <li class="alt"><li class="alt"><span class="attribute">android:state_active=["true" | "false"]</span></li></li> <li><li><span class="attribute">android:state_checkable=["true" | "false"]</span></li></li> <li class="alt"><li class="alt"><span class="attribute">android:state_checked=["true" | "false"]</span></li></li> <li><li><span class="attribute">android:state_enabled=["true" | "false"]</span></li></li> <li class="alt"><li class="alt"><span class="attribute">android:state_window_focused=["true" | "false"] <span class="tag">/></span></span></li></li> <li><li><span class="tag"></<span class="tag-name">selector<span class="tag">></span> </span></span></li></li> </ol><p><p><br></p></p><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"><br>23, fragment OnCreate used to initialize the data, Oncreateview used to initialize the interface, the former is generally only executed once, the latter with the interface switch multiple executions, so the latter is best not to do data loading, if some data loading must be done after the interface initialization, To add the first execution condition Judgment.</p></p><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;">24, TextView in the HTML tags available, Note that the label can not be directly written in the string resources, the direct write is filtered out, but written in the code of the string variable can, although not quite in line with the development of Android norms, but to avoid character conversion, It's a pretty nice Solution.</p></p><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"><p style="margin-top: 0px; margin-bottom: 8px; padding-top: 0px; padding-bottom: 0px; border: 0px; vertical-align: baseline; color: #444444; font-family: ‘Lucida Grande‘,‘Helvetica Neue‘,Helvetica,Verdana,Arial,sans-serif; font-size: 14px; line-height: 24px; white-space: pre-wrap;"></p></p><strong><strong>[html]</strong></strong>View Plain<span data-mod="popu_168"><span data-mod="popu_168">copy<span data-mod="popu_169"> print? <span class="tracking-ad" data-mod="popu_167"><span class="tracking-ad" data-mod="popu_170"></span></span> </span> </span></span> <ol class="dp-xml" start="1"> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">a <span class="attribute">href=<span class="attribute-value">"..."<span class="tag">></span> </span> </span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">b<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">big<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">blockquote<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">br<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">cite<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">DFN<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">div <span class="attribute">align=<span class="attribute-value">"..."<span class="tag">></span> </span> </span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">em<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">font <span class="attribute">size=<span class="attribute-value">"..." <span class="attribute">color=<span class="attribute-value">"..." <span class="attribute">face=<span class="attribute-value">"..."<span class="tag">></span> </span> </span> </span> </span> </span> </span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">H1<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">h2<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">h3<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">h4<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">h5<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">h6<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">i<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">img <span class="attribute">src=<span class="attribute-value">"..."<span class="tag">></span> </span> </span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">p<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">small<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">strike<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">strong<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">sub<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">sup<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">tt<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">u<span class="tag">></span> </span></span></li></li> </ol><p><p>25, onCreate, OnStart inside of the view do operation, view may not have been rendered successful, so for example getheight get 0, to ensure that the view rendering code execution, You can use View.post (runnable)</p></p><p><p>26, The listview display is not complete, because the appbarlayout accounted for two lines of Space. Move the tablayout out of the Appbarlayout</p></p><p><p>27, Why to use the Interface: no base class implementation burden, the implementation of the base class of different Sub-Class object instances of flexible Convertible. In a certain way, the interface is a cumbersome type of non-duck pattern of static typing Language.</p></p><p><p>28, fragment of the resources of the new initialization must be placed in the oncreate, placed in the Oncreateview will cause repeated calls, thus the resource leaks.</p></p><p><p>29, have leaked window com.android.internal.policy.impl.phonewindow$ that is originally added here The interaction inducement of this problem is that when the activity exits, the dialog on its interface is still showing, the solution, covering the OnDestroy method of the related component, releasing the dialog:</p></p><strong><strong>[java]</strong></strong>View Plain<span data-mod="popu_168"><span data-mod="popu_168">copy<span data-mod="popu_169"> print? <span class="tracking-ad" data-mod="popu_167"><span class="tracking-ad" data-mod="popu_170"></span></span> </span> </span></span> <ol class="dp-j" start="1"> <ol class="dp-j" start="1"> <li class="alt"><span class="annotation">@Override</span></li> <li><span class="keyword">Public <span class="keyword">void OnDestroy () {</span></span></li> <li class="alt"><span class="keyword">Super.ondestroy (); </span></li> <li><span class="keyword">if (mloadingdialog!=<span class="keyword">null && mloadingdialog.isshowing ()) {</span> </span></li> <li class="alt">Mloadingdialog.dismiss ();</li> <li>}</li> <li class="alt">}</li> </ol> </ol><p><p></p></p><p><p>In other words, a static object cannot reference a component resource, otherwise it will cause the referenced component resource not to be freed properly by the system Framework.</p></p><p><p>30. Android Studio Theme Resource Station: http://www.androidstudiothemes.com/</p></p><p><p>31, in general, with the reverse application of the component instance object variables are to be released when the component OnDestroy (=null), as for the static variable is best not to have a reference to the component, that is, there is a reverse application of the component of the object variable should not be made STATIC. Typically there are team components that have backward references to objects that are primarily system component Objects.</p></p><p><p>32. AVD Virtual machine startup error Prompt:</p></p><strong><strong>[plain]</strong></strong>View Plain<span data-mod="popu_168"><span data-mod="popu_168">copy<span data-mod="popu_169"> print? <span class="tracking-ad" data-mod="popu_167"><span class="tracking-ad" data-mod="popu_170"></span></span> </span> </span></span> <ol start="1"> <ol start="1"> <li class="alt">Emulator:warning:.//android/metrics/metrics_reporter_ga.c:138:curl_easy_perform () failed with code 7 (Error)</li> <li>Emulator:warning:.//android/metrics/metrics_reporter_ga.c:145:got HTTP Response Code 0</li> </ol> </ol><p><p><br>Modification Method: Open The Android studio->preferences, go to appearance & Behavior->system Settings->usage Statistics, A nd uncheck "Send usage statistics to Google". Now the Matrics_reporter would be disabled during emulator Starting.</p></p><p><p>Recommend not error, do this modification, or after the virtual machine startup, log old newspaper connection Error.</p></p><p><p>33, fragment GetView () in Oncreateview This function is empty before execution, so the Oncreateview function can only use their own inflate view to do Findviewbyid Operation.</p></p><p><p>34, rxandroid caused by the null pointer problem: general network data crawl finish, to operate activity or fragment resources to complete the data display update, but due to network access and user Switching interface operation time difference, when you do data display updates, Perhaps the resources of activtiy or fragment are no longer present, resulting in Nullpointer error problems, which can be resolved by making a null pointer judgment before manipulating these Resources.</p></p><p><p>35, fragment the context activity null pointer problem, because of the inconsistency between different versions of the api, in the life cycle of fragment, may exist its context activity actually does not exist or be destroyed, in this case, If you want to use this actiity object, you should also short the pointer judgment.</p></p><p><p>36, for the use of fragment, "the Android authoritative programming guide" recommended to use the standard library fragment, and discard the use of fragmentactivity, instead of using the activity class in the standard library, Discard the use of support.v4.app.fragment and use app.fragment instead of Getsupportfragmentmanager (). use the Getfragmentmanager () method instead</p></p><p><p>37, for all the view of the interface attribute value of the processing, such as getheight,getwidth, are to use post asynchronous, because the synchronization, it is easy to render the interface is not the result of rendering correctly.</p></p><p><p>Android Development Issue Notes</p></p></span>
Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.