Android development issue Summary (continually updated)

Original link: http://www.cnblogs.com/hacjy/p/5124992.html

In Android development, there is always some small problems. Since we are not careful, it is easy to ignore, leading to spending a lot of time on this issue, resulting in the delay of the progress of work.

To this end, here to do some recording, again to avoid wasting a lot of time on these issues.

1, getting value CheckedTextView, has been returned false
Solution: Set the checked property in xml, otherwise, get CheckedtextView checked property will always return false.

2, EditText text overlay
Solution: EditText of layerType set to software on it.

3, the use ImageLoader Load picture, encountered larger picture, there will be abnormal Bitmap too large to be uploaded into a texture
The solution: the program needs to load big picture, but hardware acceleration for OpenGL in memory is limited. In the AndroidManifest hardwareAccelerated set it to false.

xxxx has no methods onEvent: 4, the use of third-party framework EventBus, Exception appears in the register.
Solution: There is no reception in the Activity event, just need to send an event, but registration and cancellation of EventBus led to such mistakes. The right approach: the register and unRegister removed, direct post just fine.

5, download files, send real-time schedule, and then refresh the UI. But the file has finished downloading, UI or in the update.
Solution: Determine the difference between the current time and the last update time is greater than a certain value, and then calls the callback function again, updated UI.

6, Viewpager use to create new, likely  Resources $ NotFoundException: Resource ID # 0xffffffff exception.
Solution: To set the id viewpager manual, otherwise there will be after this abnormal so that when setAdaper.

7, fragment which contains ViewPager, fragment generally at this time will display the first display, the second will not show a problem.
Solution: In the new FragmentPagerAdapter time pass in fragmentManager Do not use getFragmentManager, using getChildFragmentManager () to resolve this issue.

8、unable to add window -- toke null is not for an application。
Solution: Only one Activity can add a form, it needs to be getApplicationContext () instead of specific Activity.

9, Fragment embedded Fragment problem --Duplicate id tag null or parent id 0x0 error
Solution: Add the following code.
if( view!=null){  

    ViewGroup parent=(ViewGroup)view.getParent();  
if( parent!=null)  
parent.removeView(view); }

 

 

Reproduced in: https: //www.cnblogs.com/hacjy/p/5124992.html

Guess you like

Origin blog.csdn.net/weixin_30687587/article/details/94795713
Recommended