create Bundle via Key and value - Android android.os

Android examples for android.os:Bundle

Description

create Bundle via Key and value

Demo Code

import android.os.Bundle;
import android.os.Parcelable;

public class Main {

  public static Bundle createBundle(final String key, final boolean value) {
    final Bundle bundle = new Bundle();
    bundle.putBoolean(key, value);//  www . ja va2s . c o m
    return bundle;
  }

  public static Bundle createBundle(final String key, final String value) {
    final Bundle bundle = new Bundle();
    bundle.putString(key, value);
    return bundle;
  }

  public static Bundle createBundle(final String key, final Parcelable value) {
    final Bundle bundle = new Bundle();
    bundle.putParcelable(key, value);
    return bundle;
  }

}

Related Tutorials