Part 1:
activity.startactivities ()Often used to start other activity in the middle of an application.
Textutils.isempty ()A simple tool class for detecting whether it is empty. (Can also judge "" and Null OH)
html.fromhtml ()Used to generate an Html, the argument can be a string. Personally think it's not very fast, so I don't use it very often. (I say that it is not often used to highlight this sentence: please manually build spannable to replace html.fromhtml), but it is for rendering from the Web The text obtained on the page is still very good.
Textview.seterror ()It's great when validating user input.
Build.version_codesThis indicates the current version number, which is often used when dealing with compatibility issues. Click to see the different features of each version.
log.getstacktracestring ()Convenient log-class tools, Methods LOG.V (), LOG.D (), LOG.I (), LOG.W (), and LOG.E () all print information to logcat, sometimes requiring the insertion of faulty information into a database or a custom log file. In this case, it is necessary to return the error message as a string, that is, when using the static string getstacktracestring (Throwable tr) method.
Layoutinflater.from ()As the name implies, for inflate a layout, the parameter is the ID of layout. The person who often writes adapter will use more.
Viewconfiguration.getscaledtouchslop ()Use the values provided in viewconfiguration to ensure that all touch interactions are uniform. The value obtained by this method indicates that the user's hand is sliding at this distance before it is determined to be slipping. Of course, this value can also be determined by itself. But for consistency, it's better to use standard values.
phonenumberutils.convertkeypadletterstodigitsAs the name implies. Converts letters to numbers, similar to T9 IME,
Context.getcachedir ()Get the path to the cached data folder, very simple but not many people know, this path is usually on the SD card (here the SD card refers to the generalized SD card, including external storage and internal storage) adnroid/data/your application package name/cache/below. When the test is over, You can go to see if the cache is successful. The advantage of caching here is that you don't have to manually create a folder yourself, and you don't have to worry about deleting the folder you created, and when the application unloads, it will be emptied, and when you use a third-party cleanup tool, it will be emptied.
ArgbevaluatorThe gradient used to process the color. As Chris Banes says, this class does a lot of auto-boxing, so it's best to get rid of its logic and implement it yourself. This is useless, unclear why, back to add.
ContextthemewrapperIt is easy to modify the theme when running.
Space space is a new control in Android 4.0 that can actually be used to separate different controls, which form a blank area. This is a lightweight view component that skips draw and is great for any scene that requires a placeholder.
Valueanimator.reverse ()This method makes it possible to cancel a running animation smoothly.
Part 2:
dateutils.formatdatetime ()Used for locale formatting, output formatting and localization time or date.
alarmmanager.setinexactrepeatingSave power by using the alarm grouping, even if you only call an alarm, this is a good choice (you can ensure that alarmmanager.cancel () is called automatically when you are finished using it. The original said the more abstract, here in detail: Setinexactrepeating refers to the setting of non-accurate alarm, use: alarmmanager.setinexactrepeating (ALARMMANAGER.RTC, Starttime,intervall, Pendingintent), a non-accurate alarm clock can only guarantee approximate time interval, but not necessarily accurate, may appear to set the interval is 30 minutes, but actually one interval 20 minutes, another interval 40 minutes. The biggest advantage is that it can be combined with alarm events, such as interval settings every 30 minutes, do not wake up sleep, 8 hours after hibernation has accumulated 16 alarm events, and when the phone is awakened, non-punctual alarm can combine 16 events into one, so it seems that the non-punctual alarm is generally more energy-saving.
formatter.formatfilesize ()A regionally formatted file size tool. In layman's terms, the size is converted to a string such as mb,g,kb.
actionbar.hide ()/.show ( )As the name implies, hiding and displaying actionbar, you can gracefully convert between fullscreen and with Actionbar.
linkify.addlinks ()Add a link on text. Very practical.
StaticlayoutThis is useful for rendering text in custom View.
activity.onbackpressed ()It is convenient to manage the back key method, sometimes you need to control the event of the return key, you can rewrite it. For example, add "point two down" back button to exit the function.
GesturedetectorUsed for listening and corresponding gesture events, such as Click, long press, slow sliding, fast sliding, easy to use, more convenient than your own implementation.
Drawfilter allows you to manipulate the canvas without invoking the Ondrew method, and you can set a drawfilter when creating a custom view to alias all view settings in the parent view.
Activitymanager.getmemoryclass ()Tells you how much memory your machine has, which is useful when calculating the cache size.
viewstubIt is an initialization View that doesn't do anything, but can then load a layout file. This is a good place to make placeholders in a slow-load View. The only drawback is that tags aren't supported, so if you're not careful, you might want to include unwanted nesting in the view structure.
Systemclock.sleep ()This method is very convenient to ensure a certain amount of time sleep, usually I used to debug and analog network delay.
displaymetrics.densityThis way you can get the pixel density of the device, most of the time it's best to let the system automatically scale the resources, but sometimes the effect of the control is better. (especially when customizing the view).
pair.create ()Easy way to build classes and constructors.
Part 3:
Urlquerysanitizer--Use this tool to make it easy to check URLs.
fragment.setarguments-because it is not possible to add parameters when building Fragment, this is a good thing to set parameters before creating Fragment (even if the configuration changes will result in destruction/rebuilding).
Dialogfragment.setshowsdialog ()--This is a very ingenious way, dialogfragment can be displayed as normal Fragment! This allows Fragment to take on dual tasks. I usually add oncreateview () and Oncreatedialog () when I create a Fragment to create a Fragment with a dual purpose.
fragmentmanager.enabledebuglogging ()-it helps when you need to observe the Fragment state.
Localbroadcastmanager-This will be safer, simpler and faster than the overall broadcast. The Event buses mechanism such as Otto is more useful for your application scenario.
Phonenumberutils.formatnumber ()As the name implies, this is used when the numbers are formatted.
Region.op ()I found it useful to compare the areas before two renderings, and if you have two paths, how do you know if they overlap? Use this method to do so.
Application.registeractivitylifecyclecallbacks--despite the lack of official documentation, I think it is a handy tool for registering the Activity's life cycle with some callback methods (as the name implies).
Versionnamesuffix--This gradle setting allows you to modify the name of the version in manifest based on different build types, for example, if you need to end with "-snapshot" in the debug version, you can easily see whether the current version is debug or release.
Cursorjoiner--If you are using only one database, you can use join in SQL, but if you receive data from two independent ContentProvider, then Cursorjoiner is useful.
genymotion--A very fast Android simulator that I have been using.
-nodpi--in the absence of a special definition, many modifiers (-mdpi,-hdpi,-xdpi, and so on) will automatically scale assets/dimensions by default, and sometimes we need to keep the display consistent, in which case we can use-nodpi.
Broadcastrecevier.setdebugunregister ()--Another handy debugging tool.
activity.recreate ()-Forcing the Activity to rebuild.
packagemanager.checksignatures ()-If you have installed two apps at the same time, you can use this method to check. Without a signature check, other people can easily imitate your app by using the same package name.
Part 4:
activity.ischangingconfigurations ()-If the configuration changes frequently in the Activity, you can use this method without having to manually save the state of the work.
Searchrecentsuggestionsprovider--a quick and easy way to create the provider of the most recent cue effect.
Viewtreeobserver--It's a great tool. You can enter into the view and monitor various states of the view structure, which I usually use to do the view measurement (often used in custom views).
org.gradle.daemon=trueThis can help reduce the time it takes to build the Gradle, only when the command-line is compiled, because Android Studio is already using it.
databaseutils--a usage tool that contains various database operations.
android:weightsum (linearlayout)-If you want to use layout weights, but don't want to fill the entire linearlayout, you can use WeightSum to define the total weight size.
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.
Android:clipchildren (ViewGroup)--If this property is set to not be available, then ViewGroup's child View will be drawn beyond its scope, and will need to be used when animating.
Android:fillviewport (ScrollView)--In this article there is a detailed article link, you can solve in the ScrollView when the content is not enough to fill the screen when the problem.
Android:tilemode (bitmapdrawable)--You can specify that the picture uses a repeating fill pattern.
android:enterfadeduration/android:exitfadeduration (drawables)--this property can define the fade effect before it is displayed when the drawable has multiple states.
Android:scaletype (ImageView)--Define how to scale/crop the picture in ImageView, the more commonly used is "Centercrop" and "Centerinside".
Merge--This tag can contain other layout files in another layout file without creating a new viewgroup, which is also needed for custom viewgroup, and can be automatically defined by loading a tabbed layout file.
Atomicfile--atomically operation of the file by using a backup file. I have written this point before, but it is better to have an official version.
Part 5:
Viewdraghelper--View dragging is a more complex issue. 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.
Popupwindow--android use Popupwindow everywhere, even you don't realize (title navigation bar Actionbar, auto complementAutoComplete, edit box Error alert EditText Errors). This class is the primary method for creating floating-layer content.
Actionbar.getthemrcontext ()The theme of the navigation bar is complex (different from the theme of other parts of the activity). You can get a context, and a custom component created with this context can get the correct theme.
thumbnailutils--help create thumbnails. Usually I load libraries with existing images (for example, Picasso or volley), but this thumbnaiutils can create video thumbnails. Translator Note: This API is only supported from V8.
Context.getexternalfilesdir ()———— apply for SD card Write permission, you can write the data anywhere in SD, it is more polite to write your data in the right place of design. This data can be cleaned up in time, and there will be a better user experience. In addition, the Android 4.0 KitKat in this folder to write data is not required permission, each user has their own independent data storage path Translator Note: The API from V8 to start support.
SparsearrayEfficient and optimized version of the--map. It is recommended to learn about sister Sparsebooleanarray, Sparseintarray and Sparselongarray.
Packagemanager.setcomponentenabledsetting ()--can be used to start or disable components in the program manifest. It is great to turn off unwanted functional components, such as turning off a broadcast receiver that is not currently in use.
sqlitedatabase.yieldifcontendedsafely ()--Lets you temporarily stop a database transaction so that you can not consume too much system resources.
environment.getexternalstoragepublicdirectory ()-or that sentence, users expect a unified user experience on the SD card. Use this method to get the correct directory for placing the specified type of file (music, pictures, etc.) on the user's device.
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.
Activitymanager.clearapplicationuserdata ()--one-click cleanup of user data generated by your app may be the easiest way to do the user exit login feature ever.
Context.createconfigurationcontext ()--Customize your configuration environment information. I usually get the problem of forcing a part to appear in a particular environment (not that I've been so blind, long story, you're hard to understand). This can be a little bit simpler to implement.
activityoptions--Easily define two animations for activity switching. Using Activityoptionscompat can be a good solution to older versions of compatibility issues.
adapterviewflipper.fyiwillbeadvancedbyhostkthx ()-Just because it's fun, there's no other reason. There are other interesting things in the entire Android Open source project (AOSP the Android--pen source project Android Open source program) (e.g.
Gravity_death_star_i). But it's not like this, it really works.
Viewparent.requestdisallowintercepttouchevent ()--android system touch event mechanism can be handled by default most of the time, but sometimes you need to use this method to deprive the parent control of control.
============================>> following supplements <<=============================
1, Android:clipchildren, and android:clipToPadding:clipToPadding means that the drawing area of the control is inside the padding, True if you set the padding then the area to be drawn is indented, clipchildren refers to whether the child control is more than the padding area, these two properties are true by default, so in the case of padding setting, the default scrolling is padding internal, to achieve the above effect mainly set these two properties false then this way the control can be drawn to the padding area. Use scenes such as: ActionBar (Transparent) to display the ListView and the first item to be under ActionBar. See Android:cliptopadding and Android:clipchildren.
2, Fragment the Setuservisiblehint method, can realize Fragment to the user is visible only load resources (lazy load).
3. Override the Hasoverlappingrendering method when customizing view to specify whether the view has overlapping and improve rendering performance.
4, Autoscrollhelper, in scrollable view, long press the edge to achieve scrolling, Android View.ontouchlistener subclasses.
5, Touchslop, the system can be recognized as the smallest sliding distance. Viewconfiguration.get (context). Getscaledtouchslop ().
6, Velocitytracker, can be used for View sliding event speed tracking.
7, Alphabetindexer, alphabetical index auxiliary class.
8, MESSENGER,AIDL implementation of the package, more convenient than handwritten aidl.
9, Arraymap, higher than HashMap memory efficiency, but slower than HashMap, not suitable for a large number of data scenes.
10, property, abstract class, encapsulates a variable attribute value in an object, using scenes such as actions on animated properties when animating with attributes.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The class-interface-method that makes you brief encounter in Android