转自:http://blog.csdn.net/guxiao1201/article/details/40655661
简介:
startActivities (Intent[] intents)
setError (CharSequence error)
动画reverse ()
addLinks (TextView text, int mask)
SystemClock public static void sleep (long ms)
registerActivityLifecycleCallbacks (Application.ActivityLifecycleCallbacks callback)
在Gradle脚本中使用该标签可以修改在Manifest中定义的VersionName
Activity public void recreate ()
checkSignatures (String pkg1, String pkg2)
android:duplicateParentState/android:addStatedFromChildren
android:clipChildren
android:fillViewport
android:tileMode
SparseArray
PackageManger.setComponentEnabledSetting使用这个方法可以开启和禁用四大组件
View public static int generateViewId ()
Same as startActivities(Intent[], Bundle)
with no options specified.
intents | The intents to start. |
---|
android.content.ActivityNotFoundException |
Returns true if the string is null or 0-length.
str | the string to be examined |
---|
Returns displayable styled text from the provided HTML string. Any <img> tags in the HTML will display as a generic replacement image which your program can then go through and replace with real images.
This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.
Sets the right-hand compound drawable of the TextView to the "error" icon and sets an error message that will be displayed in a popup when the TextView has focus. The icon and error message will be reset to null when any key events cause changes to the TextView's text. If the error
is null
, the error message and icon will be cleared.
Handy function to get a loggable stack trace from a Throwable
tr | An exception to log |
---|
Obtains the LayoutInflater from the given context.
Returns the absolute path to the application specific cache directory on the filesystem. These files will be ones that get deleted first when the device runs low on storage. There is no guarantee when these files will be deleted. Note: you should not rely on the system deleting these files for you; you should always have a reasonable maximum, such as 1 MB, for the amount of space you consume with cache files, and prune those files when exceeding that space.
Plays the ValueAnimator in reverse. If the animation is already running, it will stop itself and play backwards from the point reached when reverse was called. If the animation is not currently running, then it will start from the end and play backwards. This behavior is only set for the current animation; future playing of the animation will use the default behavior of playing forward.
Formatter public static String formatFileSize (Context context, long number)
Formats a content size to be in the form of bytes, kilobytes, megabytes, etc
context | Context to use to load the localized units |
---|---|
number | size value to be formatted |
Scans the text of the provided TextView and turns all occurrences of the link types indicated in the mask into clickable links. If matches are found the movement method for the TextView is set to LinkMovementMethod.
这个类并不常用,一般只有在自定义View时遇到长串文字需要换行时用到
Called when the activity has detected the user's press of the back key. The default implementation simply finishes the current activity, but you can override this to do whatever you want.
MotionEvent
s. The GestureDetector.OnGestureListener
callback will notify users when a particular motion event has occurred. This class should only be used with MotionEvent
s reported via touch (don't use for trackball events). To use this class:
Return the approximate per-application memory class of the current device. This gives you an idea of how hard a memory limit you should impose on your application to let the overall system work best. The returned value is in megabytes; the baseline Android memory class is 16 (which happens to be the Java heap limit of those devices); some device with more memory may return 24 or even higher numbers.
Waits a given number of milliseconds (of uptimeMillis) before returning. Similar to sleep(long)
, but does not throw InterruptedException
; interrupt()
events are deferred until the next interruptible operation. Does not return until at least the specified number of milliseconds has elapsed.
ms | to sleep before returning, in milliseconds of uptime. |
---|
The logical density of the display. This is a scaling factor for the Density Independent Pixel unit, where one DIP is one pixel on an approximately 160 dpi screen (for example a 240x320, 1.5"x2" screen), providing the baseline of the system's display. Thus on a 160dpi screen this density value will be 1; on a 120 dpi screen it would be .75; etc.
This value does not exactly follow the real screen size (as given by xdpi
and ydpi
, but rather is used to scale the size of the overall UI in steps based on gross changes in the display dpi. For example, a 240x320 screen will have a density of 1 even if its width is 1.8", 1.3", etc. However, if the screen resolution is increased to 320x480 but the screen size remained 1.5"x2" then the density would be increased (probably to 1.5).
Supply the construction arguments for this fragment. This can only be called before the fragment has been attached to its activity; that is, you should call it immediately after constructing the fragment. The arguments supplied here will be retained across fragment destroy and creation.
Breaks the given number down and formats it according to the rules for the country the number is from.
source | The phone number to format |
---|
Cause this Activity to be recreated with a new instance. This results in essentially the same flow as when the Activity is created due to a configuration change -- the current instance will go through its lifecycle to onDestroy()
and a new instance then created after it.
Compare the signatures of two packages to determine if the same signature appears in both of them. If they do contain the same signature, then they are allowed special privileges when working with each other: they can share the same user-id, run instrumentation against each other, etc.
pkg1 | First package name whose signature will be compared. |
---|---|
pkg2 | Second package name whose signature will be compared. |
SIGNATURE_MATCH
) if all signatures match or < 0 if there is not a match (SIGNATURE_NO_MATCH
or SIGNATURE_UNKNOWN_PACKAGE
).
Check to see whether this activity is in the process of being destroyed in order to be recreated with a new configuration. This is often used in onStop()
to determine whether the state needs to be cleaned up or will be passed on to the next instance of the activity via onRetainNonConfigurationInstance()
.
A view tree observer is used to register listeners that can be notified of global changes in the view tree. Such global events include, but are not limited to, layout of the whole tree, beginning of the drawing pass, touch mode change.... A ViewTreeObserver should never be instantiated by applications as it is provided by the views hierarchy. Refer to getViewTreeObserver()
for more information.
Defines the maximum weight sum. If unspecified, the sum is computed by adding the layout_weight of all of the children. This can be used for instance to give a single child 50% of the total available space by giving it a layout_weight of 0.5 and setting the weightSum to 1.0.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form "@[package:]type:name
") or theme attribute (in the form "?[package:][type:]name
") containing a value of this type.
This corresponds to the global attribute resource symbol weightSum
.
When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form "@[package:]type:name
") or theme attribute (in the form "?[package:][type:]name
") containing a value of this type.
This corresponds to the global attribute resource symbol duplicateParentState
.
Defines whether a child is limited to draw inside of its bounds or not. This is useful with animations that scale the size of the children to more than 100% for instance. In such a case, this property should be set to false to allow the children to draw outside of their bounds. The default value of this property is true.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form "@[package:]type:name
") or theme attribute (in the form "?[package:][type:]name
") containing a value of this type.
This corresponds to the global attribute resource symbol clipChildren
.
Defines whether the scrollview should stretch its content to fill the viewport.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form "@[package:]type:name
") or theme attribute (in the form "?[package:][type:]name
") containing a value of this type.
This corresponds to the global attribute resource symbol fillViewport
.
Defines the tile mode. When the tile mode is enabled, the bitmap is repeated. Gravity is ignored when the tile mode is enabled. Default value is "disabled".
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
disabled |
-1 | Do not tile the bitmap. This is the default value. |
clamp |
0 | Replicates the edge color. |
repeat |
1 | Repeats the bitmap in both direction. |
mirror |
2 | Repeats the shader's image horizontally and vertically, alternating mirror images so that adjacent images always seam. |
This corresponds to the global attribute resource symbol tileMode
.
Amount of time (in milliseconds) to fade out an old state drawable.
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form "@[package:]type:name
") or theme attribute (in the form "?[package:][type:]name
") containing a value of this type.
Controls how the image should be resized or moved to match the size of this ImageView.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
matrix |
0 | |
fitXY |
1 | |
fitStart |
2 | |
fitCenter |
3 | |
fitEnd |
4 | |
center |
5 | |
centerCrop |
6 | |
centerInside |
7 |
This corresponds to the global attribute resource symbol scaleType
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ThumbnailUtils() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static Bitmap | createVideoThumbnail( String filePath, int kind)
Create a video thumbnail for a video.
|
||||||||||
static Bitmap | extractThumbnail( Bitmap source, int width, int height, int options)
Creates a centered bitmap of the desired size.
|
||||||||||
static Bitmap | extractThumbnail( Bitmap source, int width, int height)
Creates a centered bitmap of the desired size.
|
SparseArrays map integers to Objects. Unlike a normal array of Objects, there can be gaps in the indices. It is intended to be more memory efficient than using a HashMap to map Integers to Objects, both because it avoids auto-boxing keys and its data structure doesn't rely on an extra entry object for each mapping.
Note that this container keeps its mappings in an array data structure, using a binary search to find keys. The implementation is not intended to be appropriate for data structures that may contain large numbers of items. It is generally slower than a traditional HashMap, since lookups require a binary search and adds and removes require inserting and deleting entries in the array. For containers holding up to hundreds of items, the performance difference is not significant, less than 50%.
To help with performance, the container includes an optimization when removing keys: instead of compacting its array immediately, it leaves the removed entry marked as deleted. The entry can then be re-used for the same key, or compacted later in a single garbage collection step of all removed entries. This garbage collection will need to be performed at any time the array needs to be grown or the the map size or entry values are retrieved.
It is possible to iterate over the items in this container using keyAt(int)
and valueAt(int)
. Iterating over the keys using keyAt(int)
with ascending values of the index will return the keys in ascending order, or the values corresponding to the keys in ascending order in the case of valueAt(int)
.
Set the enabled setting for a package component (activity, receiver, service, provider). This setting will override any enabled state which may have been set by the component in its manifest.
componentName | The component to enable |
---|---|
newState | The new enabled state for the component. The legal values for this state are: COMPONENT_ENABLED_STATE_ENABLED , COMPONENT_ENABLED_STATE_DISABLED andCOMPONENT_ENABLED_STATE_DEFAULT The last one removes the setting, thereby restoring the component's state to whatever was set in it's manifest (or enabled, by default). |
flags | Optional behavior flags: DONT_KILL_APP or 0. |
Generate a value suitable for use in setId(int)
. This value will not collide with ID values generated at build time by aapt for R.id.
Permits an application to erase its own data from disk. This is equivalent to the user choosing to clear the app's data from within the device settings UI. It erases all dynamic data associated with the app -- its private data and data in its private area on external storage -- but does not remove the installed application itself, nor any OBB files.
true
if the application successfully requested that the application's data be erased; false
otherwise.Context.startActivity(Intent, Bundle)
and related methods.