1, the Throwable interface in the Getstacktrace () method, according to this method can get the function of the layer by call address, its return value is stacktraceelement[];
2, Stacktraceelement class, of which four methods GetClassName (), GetFileName (), Getlinenumber (), Getmethodname () in the debug program to print log is very useful;
3, Uncaughtexceptionhandler interface, again good code exception unavoidably, using this interface can handle uncaught exception;
4, the View of the Isshown () method, used to be view.getvisibility () ==view.visible to judge
5. Aslist (T ... array) method in arrays class, array to List List.toarray ();
6, the fragment class in the Onhiddenchanged (Boolean) method, using the fragmenttransaction in the Hide (), show () as if the other life-cycle method of fragment will not be called, too pit Dad!
7, TextView class of Settransformationmethod (Transformationmethod) method, can be used to achieve "display password" function;
8, Pagetransformer interface, use to customize the Viewpager page to switch animation, with Setpagetransformer (Boolean, Pagetransformer) method to set;
9, Android:weightsum (linearlayout)-if you want to use layout weights, but do not want to fill the entire linearlayout, you can use WeightSum to define the total weight size.
10, Android:duplicateparentstate (view)--This method allows the child view to replicate the state of the parent view. For example, if a viewgroup is clickable, you can use this method to change the state of its sub-View when it is clicked.
11, Android:clipchildren (ViewGroup)--If this property is set to not be available, then ViewGroup's child View will be drawn out of its range, and it needs to be used when animating.
12, Android:fillviewport (ScrollView)--In this article has detailed the article link, can solve in ScrollView when the content is insufficient to fill the screen when the problem.
13, Android:tilemode (bitmapdrawable)--you can specify that the picture uses a repeating fill pattern.
14, Android:enterfadeduration/android:exitfadeduration (drawables)--this property can define the fade effect before it is displayed when the drawable has multiple states.
15. viewdraghelper--View dragging is a more complex problem. This class can help solve a lot of problems. If you need an example, drawerlayout is using it to make the sweep slip. Flavient Laurent also wrote some excellent articles on this.
16, View.generateviewid ()--every time I want to recommend the ID of a dynamically generated control. It is important to note that you do not duplicate the existing control ID or other control IDs that have already been generated.
17, Activitymanager.clearapplicationuserdata ()--a key to clean up the user data generated by your app, may be to do the user logout login function, the simplest way ever.
18, Context.createconfigurationcontext ()--Customize your configuration environment information. I usually get the problem of forcing a part to appear in a particular environment. This can be a little bit simpler to implement.
19, activityoptions--convenient definition of two activity switch animation. Using Activityoptionscompat can be a good solution to older versions of compatibility issues.
20, Viewparent.requestdisallowintercepttouchevent ()--android system touch event mechanism most of the time can be handled by default, but sometimes you need to use this method to deprive the parent control of control
21, argbevaluator.evaluate (float fraction, object Startvalue, Object Endvalue), used to generate a new color based on a starting color value and an end color value, and an offset. The minute implementation is similar to the bottom bar of sliding color gradients.
22. API for Cliprect, Clippath, and clipregion clipping regions in canvas.
23, Bitmap.extractalpha (); Returns the alpha value of a new bitmap,capture original image. Sometimes we need to dynamically modify the background image of an element and do not want to use more than one picture, through this method, combined with canvas and paint can dynamically modify a solid color bitmap color.
24, Handlerthread, instead of constantly new thread of the repeated physical writing threads.
25. Intentservice, a service that can go to die and not need us to manage the child thread after the job is done.
26, palette,5.0 can be added to extract a bitmap in the color of the class, combined with the above Bitmap.extractalpha, you understand.
27, Pointf,graphics package In a class, we often see in the processing of touch events when the definition of a downx, a downy used to store a coordinate, if the coordinates are not good, if you want to record too much of the coordinates of the code is bad to see. Using pointf (float x, float y) to describe a coordinate point is much clearer.
28, Statelistdrawable, the definition of selector the usual way is the XML file, but sometimes our image resources may be dynamically obtained from the server, such as many apps so-called skin, this time can only pass statelistdrawable
To complete, a variety of addstate can be.
29, Android:descendantfocusability,listview the item in the checkbox and other elements of the grab focus causes the item Click event can not respond, in addition to the corresponding element set focusable, More simply, add android:descendantfocusability= "Blocksdescendants" to the item root layout
30, TIMINGLOGGER,SDK with the printing time stamp tool, simply artifact.
Excerpt from official documents:
A utility class to help log timings splits throughout a method call. Typical usage is:
Timinglogger timings = new Timinglogger (TAG, "MethodA");
Some work a ... timings.addsplit ("Work a");
Some work B ... timings.addsplit ("Work B");
... do some work C ... timings.addsplit ("Work C"); Timings.dumptolog ();
The Dumptolog call would add the following to the log:
D/tag (3459): Methoda:begin
D/tag (3459): Methoda:9 MS, work A
D/tag (3459): methoda:1 MS, work B
D/tag (3459): Methoda:6 MS, work C
D/tag (3459): Methoda:end, MS
31, Fragment + Viewpager to write the tab menu, because to do a submission class app, may not fill out the data before the other fragment, the data will sometimes fall back. After checking a lot of value data, we understand that this is due to the fragment caching mechanism. By default, the previous page is cached when Viewpager toggles the page, and non-adjacent pages are destroyed
Viewpaper.setoffscreenpagelimit (2) Set the default cache fragment number to 2 to resolve
32, Setuservisiblehint Getuservisiblehint judge whether fragment is visible
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
In Android development, some brief encounter methods, classes, or interfaces