Android Advanced Section FAQs

Source: Internet
Author: User

Four months of training is coming to an end, thanks to new blogger from the headmaster and teachers, students help, hope that the better new blogger, students can find their own platform, pragmatic endeavor, open up a piece of their own field!


Here's a quick fix for the high-level section on common problems encountered during projects and how to resolve them:


Experience

1. What are the better experiences?

1) package

2) analysis, design, implementation

3) file structure: Physical architecture

4) Timing

5) naming

6) Constant class

7) Reuse

8) Individual Examples

9) Error Log Keywords

10) Accumulate Tool class

11) Lazy loading, multithreading mechanism

12) Console Information


    1. An exclamation mark occurred on the project

      Cause: Project configuration Issues

      FIX: Project right →perferences→java build path→libraries→ delete unwanted stuff


06-02 07:47:59.154:e/androidruntime (4103): java.lang.RuntimeException:Unable to start activity componentinfo{ Com.example.ex_templete/com.example.ex_templete. Mainactivity}: Android.view.InflateException:Binary XML file line #28: Error inflating class fragment

Reason for log prompt:

06-02 07:47:59.154:e/androidruntime (4103): caused By:java.lang.ClassCastException:com.example.ex_templete. Myfragment cannot is cast to Android.app.Fragment

Reason: The inherited activity can only add android.app.Fragment fragments, not support supportV4 fragment

FIX: Modify Inheritance Fragmentactivity

3. Associated SUPPORTV4 Source code

Source code path:

D:\Android_Prog\android-sdk_r24.2\extras\android\support\v4\src

Correlation method :

Create a new file in the Libs directory with the name: android-support-v4.jar.properties

Open the file and edit the contents as:

Src= Source code Path

650) this.width=650; "Src=" http://note.youdao.com/yws/public/resource/458211c58a5b37f1b4117505f0d80610/ e69d8c07931c4895a082907e7932cba1/3b09412e79be42678bceb4b60ffc180d "style=" border:none;height:auto;width:800px; " alt= "3b09412e79be42678bceb4b60ffc180d"/>


Close the project, and then open it.


4. Tool Environment
1) do not include Chinese and white space in the path

2) Two versions cannot be used simultaneously


5. Garbled problem

Char

Code: 25991 = text

Common encoding formats:

UTF-8

GBK Simplified Chinese

GB2312

GB18030

Big5 Traditional

ISO 8859-1

Frequently Asked Questions scenario: Client and server are encoded differently

How to solve: best Unified for Utf-8


6. Import the SUPPORTV7 library

1) Problem: The compiled version is not 5.x by default,

FIX: Modify the compiled version to 5.1.1, then clean

2) supportV7 Source code

d:\...\android-sdk_r24.2\extras\android\m2repository\com\android\support\appcompat-v7\22.1.1


7. when the project references the library, it prompts to compile the error

Cause: The project and library contain different versions of the same jar package,

Workaround: Change the two jar packages to a consistent

or delete the jar package in the project

650) this.width=650; "Src=" http://note.youdao.com/yws/public/resource/458211c58a5b37f1b4117505f0d80610/ 82519d4ab84d47aba0780a21cbca7ad8/7785d77091b849499a811b9aa23847b8 "style=" border:none;height:auto;width:800px; " alt= "7785d77091b849499a811b9aa23847b8"/>

8.ListView is not displayed

Premise:

1) server OK?

2) Check that the JSON string is successfully downloaded?


9.Viewpager Nesting Viewpager issues

Phenomenon: Banner automatic switching speed faster

Cause:Fragment's Oncreateview () method is repeatedly called

Solve:

650) this.width=650; "Src=" http://note.youdao.com/yws/public/resource/458211c58a5b37f1b4117505f0d80610/ bbb1e59cc7e64980946b4c51d25c4367/c2de4d2af8e44d5bbd06267c5a32f83d "style=" border:none;height:auto;width:800px; " alt= "c2de4d2af8e44d5bbd06267c5a32f83d"/>

650) this.width=650; "Src=" http://note.youdao.com/yws/public/resource/458211c58a5b37f1b4117505f0d80610/ Bbb1e59cc7e64980946b4c51d25c4367/339aacba50d740cc9cf394b485ff5e08 "style=" border:none;height:auto;width:800px; " alt= "339aacba50d740cc9cf394b485ff5e08"/>

Viewpager nested viewpager,fragment manager requires the use of Childfragmentmananger

Problem phenomenon: Internal viewpager pictures are sometimes not displayed


11.

Unable to execute Dex:multiple Dex files define Lcom/nostra13/universalimageloader/cache/disc/disccacheaware;

[2015-06-09 17:31:10-Welcome Interface _01] Conversion to Dalvik format failed:unable to execute dex:multiple Dex files define Lcom/nostra13/universalimageloader/ca Che/disc/disccacheaware;

Cause: The project relies on the same library multiple times

Workaround: Remove Duplicate dependencies


12. Prompt NullPointerException when using activeandroid

650) this.width=650; "Src=" http://note.youdao.com/yws/public/resource/458211c58a5b37f1b4117505f0d80610/ 82480AFBF737403B8747F57515AFC498/34E1C00673C64929BC41AAF4838F0FCC "style=" Border:none;height:auto; "alt=" 34E1C00673C64929BC41AAF4838F0FCC "/>

Cause: Application is not registered in the manifest, there is no initialization activeandroid


Three ImageView in 13.Banner cannot display a picture

Cause: The timing problem of multithreading

Banner item cannot display a picture until banner data is downloaded

After the download data is successful, the picture can be displayed

FIX: Download data before initializing banner



Android Advanced Section FAQs

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.