- 浏览: 4060366 次
文章分类
最新评论
-
klxh:
Android如何一次安装多个apk -
kchiu:
废话啊啊啊
TCP,socket 心跳检测 -
追求幸福:
iOS: 当发生signal 9为 kill的时候,程序直接被 ...
android和iOS平台的崩溃捕获和收集 -
andsy2008:
给的地址,没豆子呢,能单独发一份给我吗,andsy2008@1 ...
点餐订餐系统应用android源码 -
王粤新:
[b][i][u]引用[list]
[*][flash=200 ...
百度地图SDK for Android【事件监听】
Android自动化测试之MonkeyRunner-startActivity之component(十四)
Android自动化测试之MonkeyRunner-ComponentName
extends Objectimplements Parcelable Cloneable Comparable<T>
java.lang.Object | |
↳ | android.content.ComponentName |
Class Overview
Identifier for a specific application component (Activity
,Service
,BroadcastReceiver
,
orContentProvider
) that is available. Two pieces of information, encapsulated here, are required to identify a component: the package (a String) it exists
in, and the class (a String) name inside of that package.
Summary
From
interface
android.os.Parcelable
|
<nobr>public static final <a href="http://developer.android.com/reference/android/os/Parcelable.Creator.html"> Creator</a><<a href="http://developer.android.com/reference/android/content/ComponentName.html">ComponentName</a>></nobr> | CREATOR |
<nobr></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#ComponentName(java.lang.String,%20java.lang.String)">ComponentName</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a>
pkg, <a href="http://developer.android.com/reference/java/lang/String.html">String</a> cls)</nobr> Create a new component identifier.
|
<nobr></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#ComponentName(android.content.Context,%20java.lang.String)">ComponentName</a></span>(<a href="http://developer.android.com/reference/android/content/Context.html">Context</a>
pkg, <a href="http://developer.android.com/reference/java/lang/String.html">String</a> cls)</nobr> Create a new component identifier from a Context and class name.
|
<nobr></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#ComponentName(android.content.Context,%20java.lang.Class<?>)">ComponentName</a></span>(<a href="http://developer.android.com/reference/android/content/Context.html">Context</a>
pkg, <a href="http://developer.android.com/reference/java/lang/Class.html">Class</a><?> cls)</nobr> Create a new component identifier from a Context and Class object.
|
<nobr></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#ComponentName(android.os.Parcel)">ComponentName</a></span>(<a href="http://developer.android.com/reference/android/os/Parcel.html">Parcel</a>
in)</nobr> Instantiate a new ComponentName from the data in a Parcel that was previously written with
writeToParcel(Parcel,
int) . |
<nobr><a href="http://developer.android.com/reference/android/content/ComponentName.html">ComponentName</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#clone()">clone</a></span>()</nobr> Creates and returns a copy of this
Object . |
<nobr>int</nobr> | <nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#compareTo(android.content.ComponentName)">compareTo</a></span>(<a href="http://developer.android.com/reference/android/content/ComponentName.html">ComponentName</a> that)</nobr> |
<nobr>int</nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#describeContents()">describeContents</a></span>()</nobr> Describe the kinds of special objects contained in this Parcelable's marshalled representation.
|
<nobr>boolean</nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#equals(java.lang.Object)">equals</a></span>(<a href="http://developer.android.com/reference/java/lang/Object.html">Object</a>
obj)</nobr> Compares this instance with the specified object and indicates if they are equal.
|
<nobr><a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#flattenToShortString()">flattenToShortString</a></span>()</nobr> The same as
flattenToString() , but abbreviates the class name if it is a suffix of the package. |
<nobr><a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#flattenToString()">flattenToString</a></span>()</nobr> Return a String that unambiguously describes both the package and class names contained in the ComponentName.
|
<nobr><a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#getClassName()">getClassName</a></span>()</nobr> Return the class name of this component.
|
<nobr><a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#getPackageName()">getPackageName</a></span>()</nobr> Return the package name of this component.
|
<nobr><a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#getShortClassName()">getShortClassName</a></span>()</nobr> Return the class name, either fully qualified or in a shortened form (with a leading '.') if it is a suffix of the package.
|
<nobr>int</nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#hashCode()">hashCode</a></span>()</nobr> Returns an integer hash code for this object.
|
<nobr>static <a href="http://developer.android.com/reference/android/content/ComponentName.html"> ComponentName</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#readFromParcel(android.os.Parcel)">readFromParcel</a></span>(<a href="http://developer.android.com/reference/android/os/Parcel.html">Parcel</a>
in)</nobr> Read a ComponentName from a Parcel that was previously written with
writeToParcel(ComponentName,
Parcel) , returning either a null or new object as appropriate. |
<nobr><a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#toShortString()">toShortString</a></span>()</nobr> Return string representation of this class without the class's name as a prefix.
|
<nobr><a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#toString()">toString</a></span>()</nobr> Returns a string containing a concise, human-readable description of this object.
|
<nobr>static <a href="http://developer.android.com/reference/android/content/ComponentName.html"> ComponentName</a></nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#unflattenFromString(java.lang.String)">unflattenFromString</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a>
str)</nobr> Recover a ComponentName from a String that was previously created with
flattenToString() . |
<nobr>void</nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#writeToParcel(android.os.Parcel,%20int)">writeToParcel</a></span>(<a href="http://developer.android.com/reference/android/os/Parcel.html">Parcel</a>
out, int flags)</nobr> Flatten this object in to a Parcel.
|
<nobr>static void</nobr> |
<nobr><span class="sympad"><a href="http://developer.android.com/reference/android/content/ComponentName.html#writeToParcel(android.content.ComponentName,%20android.os.Parcel)">writeToParcel</a></span>(<a href="http://developer.android.com/reference/android/content/ComponentName.html">ComponentName</a>
c, <a href="http://developer.android.com/reference/android/os/Parcel.html">Parcel</a> out)</nobr> Write a ComponentName to a Parcel, handling null pointers.
|
From class
java.lang.Object
|
||||||||||||||||||||||
From interface
android.os.Parcelable
|
||||||||||||||||||||||
From interface
java.lang.Comparable
|
Fields
Public Constructors
public ComponentName(String pkg,String cls)
Create a new component identifier.
Parameters
The name of the package that the component exists in. Can not be null. |
The name of the class inside of pkg that implements the component. Can not be null. |
public ComponentName(Context pkg,String cls)
Create a new component identifier from a Context and class name.
Parameters
A Context for the package implementing the component, from which the actual package name will be retrieved. |
The name of the class inside of pkg that implements the component. |
public ComponentName(Context pkg,Class<?> cls)
Create a new component identifier from a Context and Class object.
Parameters
A Context for the package implementing the component, from which the actual package name will be retrieved. |
The Class object of the desired component, from which the actual class name will be retrieved. |
public ComponentName(Parcel in)
Instantiate a new ComponentName from the data in a Parcel that was previously written withwriteToParcel(Parcel, int)
.
Note that you must not use this with data written bywriteToParcel(ComponentName, Parcel)
since
it is not possible to handle a null ComponentObject here.
Parameters
The Parcel containing the previously written ComponentName, positioned at the location in the buffer where it was written. |
Public Methods
public ComponentName clone ()
Creates and returns a copy of this Object
. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new
instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should callsuper.clone()
to create the new instance and then create deep copies of the nested, mutable objects.
Returns
- a copy of this object.
public int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Returns
- a bitmask indicating the set of special object types marshalled by the Parcelable.
public boolean equals(Object obj)
Compares this instance with the specified object and indicates if they are equal. In order to be equal,o
must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be
reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.
The default implementation returns true
only if this == o
. SeeWriting a correctequals
method if you intend implementing your
ownequals
method.
The general contract for the equals
and hashCode()
methods is that ifequals
returnstrue
for any two objects, thenhashCode()
must return the same value for these objects. This means that subclasses ofObject
usually override either both methods or neither of them.
Parameters
the object to compare this instance with. |
Returns
-
true
if the specified object is equal to thisObject
;false
otherwise.
public String flattenToShortString ()
The same as flattenToString()
, but abbreviates the class name if it is a suffix of the package. The result can still be used withunflattenFromString(String)
.
Returns
- Returns a new String holding the package and class names. This is represented as the package name, concatenated with a '/' and then the class name.
See Also
public String flattenToString ()
Return a String that unambiguously describes both the package and class names contained in the ComponentName. You can later recover the ComponentName from this string throughunflattenFromString(String)
.
Returns
- Returns a new String holding the package and class names. This is represented as the package name, concatenated with a '/' and then the class name.
See Also
public String getShortClassName ()
Return the class name, either fully qualified or in a shortened form (with a leading '.') if it is a suffix of the package.
public int hashCode()
Returns an integer hash code for this object. By contract, any two objects for whichequals(Object)
returnstrue
must return the same
hash code value. This means that subclasses ofObject
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See
Writing a correct hashCode
method if you intend implementing your ownhashCode
method.
Returns
- this object's hash code.
public static ComponentName readFromParcel (Parcel in)
Read a ComponentName from a Parcel that was previously written with writeToParcel(ComponentName, Parcel)
,
returning either a null or new object as appropriate.
Parameters
The Parcel from which to read the ComponentName |
Returns
- Returns a new ComponentName matching the previously written object, or null if a null had been written.
See Also
public String toShortString ()
Return string representation of this class without the class's name as a prefix.
public String toString ()
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See
Writing a useful toString
method if you intend implementing your owntoString
method.
Returns
- a printable representation of this object.
public static ComponentName unflattenFromString (String str)
Recover a ComponentName from a String that was previously created with flattenToString()
. It splits the string at the first '/', taking
the part before as the package name and the part after as the class name. As a special convenience (to use, for example, when parsing component names on the command line), if the '/' is immediately followed by a '.' then the final class name will be the concatenation
of the package name with the string following the '/'. Thus "com.foo/.Blah" becomes package="com.foo" class="com.foo.Blah".
Parameters
The String that was returned by flattenToString(). |
Returns
- Returns a new ComponentName containing the package and class names that were encoded instr
See Also
public void writeToParcel(Parcel out, int flags)
Flatten this object in to a Parcel.
Parameters
The Parcel in which the object should be written. |
Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . |
public static void writeToParcel(ComponentName c,Parcel out)
Write a ComponentName to a Parcel, handling null pointers. Must be read with
readFromParcel(Parcel)
.
Parameters
The ComponentName to be written. |
The Parcel in which the ComponentName will be placed. |
相关推荐
Android自动化测试之MonkeyRunner--从环境构建、参数讲解、脚本制作到实战技巧
android自动化测试monkeyrunner的入门使用教程,讲解了如何使用monkeyrunner进行android的自动化测试
Android自动化测试之MonkeyRunner--从环境构建、参数讲解、脚本制作到实战技巧.pdf
Android自动化测试(MonkeyRunner)脚本
Android自动化测试之Monkeyrunner常用操作编程 本篇乃本人学习monkeyrunner时笔记,查看网络中的资料并经本人测试而出,由于本人刚接触,所以本篇内容不免肤浅,高手们请绕走~ 在测试本人以下实例时,请自行搭建...
详细介绍了如何搭建Android自动化测试环境以及使用Monkeyrunner进行自动化测试的方法。
该文档包含了本人对android自动化测试工具monkeyrunner的一些总结,有需要的可以看看。
文档内容比较简单易懂,是有关于Android MonkeyRunner自动化测试的简单尝试
Android自动测试之monkeyrunner工具.docxAndroid自动测试之monkeyrunner工具.docx
MonkeyRunner-官方Doc
monkeyrunner工具提供一个API来控制Android设备。可以写一个python脚本来安装应用,运行应用,发送键值,截图。monkeyrunner对python进行了封装,加入了一些针对Android设备的类。可以完全用python脚本来实现这些...
本文主要通过PPT的方式来介绍APP自动化相关知识,并且以MonKeyRunner为例讲解如何通过MonKeyRunner实战操作自动化测试
知识共享-Android自动测试之monkeyrunner工具(雷惊风).
用于测试Android计算器,适合初学monkeyrunner测试脚本编写者
Android自动测试之monkeyrunner工具 Android自动测试之Monkey工具 Android自动化测试初探 Android自动化测试可行性途径分析 Android自动化测试之道 GSM手机自动化测试解决方案 手机自动化测试系统设计浅析 在...
该文档适用于android平台项目的软件自动化测试,本文档描述了Monkeyrunner环境配置和具体使用教程,可供学习
非扫描版 带书签许奔 著ISBN:978-7-111-52120-4目录本书赞誉前言第一部分 基础篇第1章 Android自动化测试基础1.1 Android自动化分析1.2 什么样的兵器最称手1.3 如何耍好你手上的兵器1.4 你了解你的兵器吗1.5...
NULL 博文链接:https://myeyeofjava.iteye.com/blog/1561738
Android UiAutomator 自动化测试原理 1、Android自动化工具简介 2、环境安装配置 3、测试原理及案例 4、其它注意事项 Android官方自动化测试工具 基于python Monkey是Android SDK自带的测试工具 MonkeyRunner也是...
lowen 基于monkeyrunner的android应用的自动化测试,并输出测试结果到html的框架 仿腾讯utest测试框架 代码有待完善,欢迎有兴趣的朋友一起讨论(目前报表里面使用echarts部分没有写数据处理逻辑,框架已搭好) ...