Java Code Examples for android.os.Parcel

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project AmDroid, under directory /AmDroidTest/src/main/java/com/jaeckel/amenoid/test/.

Source file: ParcelITest.java

  19 
vote

public void testObjekt() throws Exception {
  Log.d(TAG,"testObjekt");
  Objekt objekt=new Objekt();
  objekt.setName("Test Name");
  objekt.setCategory("Test Category");
  Parcel parcel=Parcel.obtain();
  objekt.writeToParcel(parcel,0);
  parcel.setDataPosition(0);
  Objekt createFromParcel=Objekt.CREATOR.createFromParcel(parcel);
  assertEquals(createFromParcel,objekt);
}
 

Example 2

From project android-database-sqlcipher, under directory /src/net/sqlcipher/.

Source file: BulkCursorNative.java

  18 
vote

public void onMove(int position) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IBulkCursor.descriptor);
  data.writeInt(position);
  mRemote.transact(ON_MOVE_TRANSACTION,data,reply,0);
  DatabaseUtils.readExceptionFromParcel(reply);
  data.recycle();
  reply.recycle();
}
 

Example 3

From project android-vpn-server, under directory /src/android/net/vpn/.

Source file: VpnTest.java

  18 
vote

@SmallTest public void testParcelable(){
  VpnProfile p=createTestProfile(VpnState.CONNECTED);
  Parcel parcel=Parcel.obtain();
  p.writeToParcel(parcel,0);
  parcel.setDataPosition(0);
  testVpnProfile(VpnProfile.CREATOR.createFromParcel(parcel),null);
}
 

Example 4

From project android-vpn-settings, under directory /src/android/net/vpn/.

Source file: VpnTest.java

  18 
vote

@SmallTest public void testParcelable(){
  VpnProfile p=createTestProfile(VpnState.CONNECTED);
  Parcel parcel=Parcel.obtain();
  p.writeToParcel(parcel,0);
  parcel.setDataPosition(0);
  testVpnProfile(VpnProfile.CREATOR.createFromParcel(parcel),null);
}
 

Example 5

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/fuelgauge/.

Source file: BatteryHistoryDetail.java

  18 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  byte[] data=getIntent().getByteArrayExtra(EXTRA_STATS);
  Parcel parcel=Parcel.obtain();
  parcel.unmarshall(data,0,data.length);
  parcel.setDataPosition(0);
  setContentView(R.layout.preference_batteryhistory);
  mStats=com.android.internal.os.BatteryStatsImpl.CREATOR.createFromParcel(parcel);
  BatteryHistoryChart chart=(BatteryHistoryChart)findViewById(R.id.battery_history_chart);
  chart.setStats(mStats);
}
 

Example 6

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: UIActivity.java

  18 
vote

private void writeRenderEffect(int id){
  try {
    IBinder flinger=ServiceManager.getService("SurfaceFlinger");
    if (flinger != null) {
      Parcel data=Parcel.obtain();
      data.writeInterfaceToken("android.ui.ISurfaceComposer");
      data.writeInt(id);
      flinger.transact(1014,data,null,0);
      data.recycle();
    }
  }
 catch (  RemoteException ex) {
  }
}
 

Example 7

From project Cafe, under directory /testservice/src/com/baidu/cafe/remote/.

Source file: SystemLib.java

  18 
vote

private void load(){
  try {
    byte[] data=mBatteryInfo.getStatistics();
    Parcel parcel=Parcel.obtain();
    parcel.unmarshall(data,0,data.length);
    parcel.setDataPosition(0);
    mStats=com.android.internal.os.BatteryStatsImpl.CREATOR.createFromParcel(parcel);
    mStats.distributeWorkLocked(BatteryStats.STATS_SINCE_CHARGED);
  }
 catch (  RemoteException e) {
    Log.print("RemoteException:" + e);
  }
}
 

Example 8

From project cornerstone, under directory /frameworks/base/core/java/android/app/.

Source file: ActivityManagerNative.java

  18 
vote

public boolean startNextMatchingActivity(IBinder callingActivity,Intent intent) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(callingActivity);
  intent.writeToParcel(data,0);
  mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION,data,reply,0);
  reply.readException();
  int result=reply.readInt();
  reply.recycle();
  data.recycle();
  return result != 0;
}
 

Example 9

From project android-bankdroid, under directory /src/com/liato/bankdroid/lockpattern/.

Source file: LockPatternView.java

  15 
vote

/** 
 * Constructor called from  {@link #CREATOR}
 */
private SavedState(Parcel in){
  super(in);
  mSerializedPattern=in.readString();
  mDisplayMode=in.readInt();
  mInputEnabled=(Boolean)in.readValue(null);
  mInStealthMode=(Boolean)in.readValue(null);
  mTactileFeedbackEnabled=(Boolean)in.readValue(null);
}
 

Example 10

From project android-client_1, under directory /src/com/googlecode/asmack/.

Source file: Stanza.java

  15 
vote

/** 
 * Persist the Stanza to a Parcel.
 * @param dest The target parcel.
 * @param flags Ignored
 */
@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeString(name);
  dest.writeString(namespace);
  dest.writeString(via);
  dest.writeInt(attributes.size());
  for (  Attribute attribute : attributes) {
    dest.writeString(attribute.getName());
    dest.writeString(attribute.getNamespace());
    dest.writeString(attribute.getValue());
  }
  dest.writeString(xml);
}
 

Example 11

From project android-cropimage, under directory /src/com/android/camera/.

Source file: ImageManager.java

  15 
vote

public void writeToParcel(Parcel out,int flags){
  out.writeInt(mLocation.ordinal());
  out.writeInt(mInclusion);
  out.writeInt(mSort);
  out.writeString(mBucketId);
  out.writeParcelable(mSingleImageUri,flags);
  out.writeInt(mIsEmptyImageList ? 1 : 0);
}
 

Example 12

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/zeroconf/.

Source file: XBMCHost.java

  15 
vote

public static ArrayList<XBMCHost> fromParcel(Parcel parcel){
  final int s=parcel.readInt();
  final ArrayList<XBMCHost> hosts=new ArrayList<XBMCHost>(s);
  for (int i=0; i < s; i++) {
    hosts.add(parcel.<XBMCHost>readParcelable(XBMCHost.class.getClassLoader()));
  }
  return hosts;
}
 

Example 13

From project AndroidCommon, under directory /src/com/asksven/android/common/privateapiproxies/.

Source file: HistoryItem.java

  15 
vote

@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeLong(m_time);
  dest.writeLong(m_offset);
  dest.writeByte(m_cmd);
  dest.writeByte(m_batteryLevel);
  dest.writeByte(m_batteryStatusValue);
  dest.writeByte(m_batteryHealthValue);
  dest.writeByte(m_batteryPlugTypeValue);
  dest.writeString(m_batteryTemperatureValue);
  dest.writeString(m_batteryVoltageValue);
  dest.writeInt(m_statesValue);
}
 

Example 14

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/provider/.

Source file: BooksStore.java

  15 
vote

private Book(Parcel in){
  mIsbn=in.readString();
  mEan=in.readString();
  mInternalId=in.readString();
  mTitle=in.readString();
  mAuthors=new ArrayList<String>(1);
  in.readStringList(mAuthors);
}
 

Example 15

From project android_7, under directory /src/org/immopoly/android/model/.

Source file: Flat.java

  15 
vote

public void writeToParcel(Parcel dest,int flags){
  dest.writeInt(uid);
  dest.writeString(name);
  dest.writeString(description);
  dest.writeString(city);
  dest.writeString(titlePictureSmall);
  dest.writeString(priceValue);
  dest.writeString(currency);
  dest.writeString(priceIntervaleType);
  dest.writeDouble(lat);
  dest.writeDouble(lng);
  dest.writeLong(creationDate);
}
 

Example 16

From project android_packages_apps_FileManager, under directory /src/org/openintents/filemanager/.

Source file: IconifiedText.java

  15 
vote

public IconifiedText(Parcel in){
  mText=in.readString();
  mInfo=in.readString();
  mSelectable=in.readInt() == 1 ? true : false;
  mSelected=in.readInt() == 1 ? true : false;
  mCheckBoxVisible=in.readInt() == 1 ? true : false;
}
 

Example 17

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: ImageManager.java

  15 
vote

public void writeToParcel(Parcel out,int flags){
  out.writeInt(mLocation.ordinal());
  out.writeInt(mInclusion);
  out.writeInt(mSort);
  out.writeString(mBucketId);
  out.writeParcelable(mSingleImageUri,flags);
  out.writeInt(mIsEmptyImageList ? 1 : 0);
}
 

Example 18

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/photoeditor/actions/.

Source file: Doodle.java

  15 
vote

@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeInt(color);
  dest.writeInt(points.size());
  for (  PointF point : points) {
    dest.writeParcelable(point,0);
  }
}
 

Example 19

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/record/.

Source file: VCardRecord.java

  15 
vote

protected VCardRecordEditInfo(Parcel parcel){
  super(parcel);
  mLookupUri=parcel.readParcelable(null);
  int valueLength=parcel.readInt();
  if (valueLength > 0) {
    mValue=new byte[valueLength];
    parcel.readByteArray(mValue);
  }
}
 

Example 20

From project andstatus, under directory /src/org/andstatus/app/account/.

Source file: MyAccount.java

  15 
vote

private MyAccount(Parcel source){
  boolean isPersistent=getDataBoolean(KEY_PERSISTENT,false);
  mUserData=source.readBundle();
  loadMyAccount(null,false);
  if (isPersistent) {
    mAccount=mUserData.getParcelable(KEY_ACCOUNT);
    if (mAccount == null) {
      isPersistent=false;
      Log.e(TAG,"The account was marked as persistent:" + this);
    }
    mIsPersistent=isPersistent;
  }
}
 

Example 21

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: Download.java

  15 
vote

@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeString(mUrl);
  dest.writeLong(mSize);
  dest.writeLong(mDownloaded);
  dest.writeInt(mStatus);
  dest.writeString(mTitle);
}
 

Example 22

From project apps-for-android, under directory /Panoramio/src/com/google/android/panoramio/.

Source file: PanoramioItem.java

  15 
vote

public PanoramioItem(Parcel in){
  mId=in.readLong();
  mBitmap=Bitmap.CREATOR.createFromParcel(in);
  mLocation=new GeoPoint(in.readInt(),in.readInt());
  mTitle=in.readString();
  mOwner=in.readString();
  mThumbUrl=in.readString();
  mOwnerUrl=in.readString();
  mPhotoUrl=in.readString();
}
 

Example 23

From project AsmackService, under directory /src/com/googlecode/asmack/.

Source file: Stanza.java

  15 
vote

/** 
 * Persist the Stanza to a Parcel.
 * @param dest The target parcel.
 * @param flags Ignored
 */
@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeString(name);
  dest.writeString(namespace);
  dest.writeString(via);
  dest.writeInt(attributes.size());
  for (  Attribute attribute : attributes) {
    dest.writeString(attribute.getName());
    dest.writeString(attribute.getNamespace());
    dest.writeString(attribute.getValue());
  }
  dest.writeString(xml);
}
 

Example 24

From project Barcamp-Bangalore-Android-App, under directory /slidingmenu/library/src/com/slidingmenu/lib/.

Source file: CustomViewAbove.java

  15 
vote

SavedState(Parcel in,ClassLoader loader){
  super(in);
  if (loader == null) {
    loader=getClass().getClassLoader();
  }
  position=in.readInt();
  adapterState=in.readParcelable(loader);
  this.loader=loader;
}
 

Example 25

From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/datatype/.

Source file: AssignmentData.java

  15 
vote

public AssignmentData(Parcel in){
  mResourceId=in.readInt();
  mUnlockResourceId=in.readInt();
  mId=in.readString();
  mDescription=in.readString();
  mSet=in.readString();
  mObjectives=in.createTypedArrayList(AssignmentData.Objective.CREATOR);
  mDependencies=in.createTypedArrayList(AssignmentData.Dependency.CREATOR);
  mUnlocks=in.createTypedArrayList(AssignmentData.Unlock.CREATOR);
}
 

Example 26

From project Birthday-widget, under directory /Birthday/src/main/java/cz/krtinec/birthday/dto/.

Source file: EditableEvent.java

  15 
vote

private EditableEvent(Parcel in){
  eventId=in.readLong();
  label=in.readString();
  type=EventType.getEventType(in.readInt());
  Long evtLong=in.readLong();
  integrity=DateIntegrity.valueOf(in.readString());
  Long contactId=in.readLong();
  rawContactId=contactId == -1 ? null : contactId;
}
 

Example 27

From project BreizhCamp-android, under directory /src/org/breizhjug/breizhcamp/model/.

Source file: Session.java

  15 
vote

@SuppressWarnings("unchecked") public Session(Parcel in){
  title=in.readString();
  description=in.readString();
  room=in.readParcelable(this.getClass().getClassLoader());
  timeslot=in.readParcelable(this.getClass().getClassLoader());
  speakers=in.readArrayList(this.getClass().getClassLoader());
  subjects=in.readArrayList(this.getClass().getClassLoader());
}
 

Example 28

From project CalendarView_1, under directory /src/org/kazzz/view/calendar/.

Source file: DateInfo.java

  15 
vote

@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeInt(this.year);
  dest.writeInt(this.month);
  dest.writeInt(this.day);
  dest.writeInt(this.hour);
  dest.writeInt(this.minute);
  dest.writeInt(this.isHoliday ? 1 : 0);
  dest.writeString(this.holidayName);
}
 

Example 29

From project CineShowTime-Android, under directory /Libraries/CineShowTime/src/com/binomed/showtime/android/model/.

Source file: AbstractModel.java

  15 
vote

protected <T>T readParcel(Parcel parcel,Class<T> clazz){
  T value=null;
  try {
    value=(T)parcel.readParcelable(clazz.getClassLoader());
  }
 catch (  ClassCastException e) {
  }
  return value;
}