Example usage for android.os Bundle Bundle

List of usage examples for android.os Bundle Bundle

Introduction

In this page you can find the example usage for android.os Bundle Bundle.

Prototype

public Bundle() 

Source Link

Document

Constructs a new, empty Bundle.

Usage

From source file:Main.java

public static void launchActivity(Context context, Class<?> activity, String key, int value) {
    Bundle bundle = new Bundle();
    bundle.putInt(key, value);/*  w w  w  .  j  av  a 2  s  .  co  m*/
    launchActivity(context, activity, bundle);
}

From source file:Main.java

public static Bundle decodeUrl(String s) {
    Bundle params = new Bundle();
    if (s != null) {
        String array[] = s.split("&");
        for (String parameter : array) {
            String v[] = parameter.split("=");
            try {
                params.putString(URLDecoder.decode(v[0], "UTF-8"), URLDecoder.decode(v[1], "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();/*from w ww. j  a v a2 s.co m*/

            }
        }
    }
    return params;
}

From source file:Main.java

public static Bundle decodeUrl(String s) {
    Bundle params = new Bundle();
    if (s != null) {
        String array[] = s.split("&");
        for (String parameter : array) {
            String v[] = parameter.split("=");
            params.putString(v[0], v[1]);
        }/*from   www  .  j av a 2 s.  c  o  m*/
    }
    return params;
}

From source file:Main.java

/**
 * Create a Parcelable Bundle containing a String message for transport to the test package engine.
 * The String message is stored via Bundle.putString using {@link #BUNDLE_MESSAGE} as the key for the item. 
 * @param message to send across processes.
 * @return Parcelable Bundle/* ww w  .  j a va2 s.  com*/
 * @see Bundle#putString(String, String)
 * @see Bundle#getString(String) 
 */
public static Parcelable setParcelableMessage(String message) {
    Bundle bundle = new Bundle();
    bundle.putString(BUNDLE_MESSAGE, message);
    bundle.setClassLoader(Bundle.class.getClassLoader());
    return bundle;
}

From source file:Main.java

/**
 * This version is for running in the foreground. It shows the user an access request screen.
 * @param accountManager//  w  w  w.  j  av a 2s. c  o m
 * @param account
 * @param ota
 * @param activity
 */
public static void getAuthTokenFromAccountManager(AccountManager accountManager, Account account,
        AccountManagerCallback<Bundle> ota, Activity activity) {
    Bundle bundle = new Bundle();
    accountManager.getAuthToken(account, // Account to use
            DOCS_SCOPE, // Authorization scope
            bundle, // Authenticator-specific options
            activity, // Your activity
            ota, // Callback called when a token is successfully acquired
            null); // Callback called if an error occurs
}

From source file:com.wellsandwhistles.android.redditsp.fragments.CommentPropertiesDialog.java

public static CommentPropertiesDialog newInstance(final RedditComment comment) {

    final CommentPropertiesDialog pp = new CommentPropertiesDialog();

    final Bundle args = new Bundle();
    args.putParcelable("comment", comment);
    pp.setArguments(args);//  w w w .  j a v a 2 s  .  c om

    return pp;
}

From source file:Main.java

public static Bundle convertHashMapToBundle(HashMap<String, String> properties) {
    if (properties == null) {
        return null;
    }//  w w  w. j a  v  a  2s .  c  o  m
    Bundle result = new Bundle();
    for (Map.Entry<String, String> entry : properties.entrySet()) {
        result.putString(entry.getKey(), entry.getValue());
    }
    return result;
}

From source file:Main.java

/**
 * Registers a file provider./*from   w w  w.  ja v  a  2 s. c  om*/
 * 
 * @param id
 *            the provider ID. It should be a UUID.
 * @param authority
 *            the autority.
 */
public static void registerProviderInfo(String id, String authority) {
    Bundle bundle = new Bundle();
    bundle.putString(COLUMN_AUTHORITY, authority);
    MAP_PROVIDER_INFO.put(id, bundle);
}

From source file:Main.java

/**
 * Converts an intent into a {@link Bundle} suitable for use as fragment
 * arguments./*from w w  w  . j  a  v a2  s  . c  om*/
 */
public static Bundle intentToFragmentArguments(Intent intent) {
    Bundle arguments = new Bundle();
    if (intent == null) {
        return arguments;
    }

    final Uri data = intent.getData();
    if (data != null) {
        arguments.putParcelable("_uri", data);
    }

    final Bundle extras = intent.getExtras();
    if (extras != null) {
        arguments.putAll(intent.getExtras());
    }

    return arguments;
}

From source file:Main.java

public static void launchActivity(Context context, Class<?> activity, String key, String value) {
    Bundle bundle = new Bundle();
    bundle.putString(key, value);/*  ww  w .j  a v  a  2  s.  c  om*/
    launchActivity(context, activity, bundle);
}