Android中的应用
Bundle类、Intent类、ArrayList等
Bundle类,该类实现了Cloneable接口
Intent类,该类也实现了Cloneable接口
@Override
public Object clone() {
return new Intent(this);
}
public Intent(Intent o) {
this.mAction = o.mAction;
this.mData = o.mData;
this.mType = o.mType;
this.mPackage = o.mPackage;
this.mComponent = o.mComponent;
this.mFlags = o.mFlags;
this.mContentUserHint = o.mContentUserHint;
if (o.mCategories !=null) {
this.mCategories =new ArraySet(o.mCategories);}
if (o.mExtras !=null) {this.mExtras =new Bundle(o.mExtras);}
if (o.mSourceBounds !=null) {this.mSourceBounds =new Rect(o.mSourceBounds);}
if (o.mSelector !=null) {this.mSelector =new Intent(o.mSelector);}
if (o.mClipData !=null) {this.mClipData =new ClipData(o.mClipData);
}
}
Uri uri = Uri.parse("smsto:10086");
Intent shareIntent =new Intent(Intent.ACTION_SENDTO, uri);
shareIntent.putExtra("sms_body","hello");
Intent intent = (Intent)shareIntent.clone() ;
startActivity(intent);
网友评论