Example usage for android.os Bundle putString

List of usage examples for android.os Bundle putString

Introduction

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

Prototype

public void putString(@Nullable String key, @Nullable String value) 

Source Link

Document

Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.miz.mizuu.fragments.CoverSearchFragment.java

public static CoverSearchFragment newInstance(String tmdbId, String json, String baseUrl) {
    CoverSearchFragment pageFragment = new CoverSearchFragment();
    Bundle b = new Bundle();
    b.putString("tmdbId", tmdbId);
    b.putString("json", json);
    b.putString("baseUrl", baseUrl);
    pageFragment.setArguments(b);//  w w  w . j  av  a 2  s  .co  m
    return pageFragment;
}

From source file:com.miz.mizuu.fragments.CollectionCoverSearchFragment.java

public static CollectionCoverSearchFragment newInstance(String collectionId, String json, String baseUrl) {
    CollectionCoverSearchFragment pageFragment = new CollectionCoverSearchFragment();
    Bundle b = new Bundle();
    b.putString("collectionId", collectionId);
    b.putString("json", json);
    b.putString("baseUrl", baseUrl);
    pageFragment.setArguments(b);/*from w  w w  .ja v a2  s  . c  o m*/
    return pageFragment;
}

From source file:Main.java

/**
 *  //from w  w  w.ja va2  s. c om
 * @param bundle
 * @param key
 * @param object
 */
private static void putBundleObject(Bundle bundle, String key, Object object) {
    if (bundle != null && object != null && !TextUtils.isEmpty(key)) {
        if (object instanceof String) {
            bundle.putString(key, (String) object);
        } else if (object instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) object);
        } else if (object instanceof Double) {
            bundle.putDouble(key, (Double) object);
        } else if (object instanceof Float) {
            Float value = (Float) object;
            bundle.putDouble(key, (double) value);
        } else if (object instanceof Integer) {
            bundle.putInt(key, (Integer) object);
        } else if (object instanceof Long) {
            bundle.putLong(key, (Long) object);
        } else if (object instanceof JSONObject) {
            object = parseBundle((JSONObject) object);
            bundle.putBundle(key, (Bundle) object);
        } else if (object instanceof JSONArray) {
            int elementQuantity = ((JSONArray) object).length();
            Bundle subBundle = new Bundle(elementQuantity);
            for (int i = 0; i < elementQuantity; i++) {
                Object subObject = getArrayValue((JSONArray) object, i, null);
                if (subObject != null) {
                    putBundleObject(subBundle, key, subObject);
                }
            }
        }
    }
}

From source file:com.facebook.AccessTokenManager.java

private static GraphRequest createExtendAccessTokenRequest(AccessToken accessToken,
        GraphRequest.Callback callback) {
    Bundle parameters = new Bundle();
    parameters.putString("grant_type", "fb_extend_sso_token");
    return new GraphRequest(accessToken, TOKEN_EXTEND_GRAPH_PATH, parameters, HttpMethod.GET, callback);
}

From source file:com.granita.contacticloudsync.syncadapter.AccountSettings.java

public static Bundle createBundle(ServerInfo serverInfo) {
    Bundle bundle = new Bundle();
    bundle.putString(KEY_SETTINGS_VERSION, String.valueOf(CURRENT_VERSION));
    bundle.putString(KEY_USERNAME, serverInfo.getUserName());
    bundle.putString(KEY_AUTH_PREEMPTIVE, Boolean.toString(serverInfo.isAuthPreemptive()));
    return 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("=");
            // YG: in case param has no value
            if (v.length == 2) {
                params.putString(URLDecoder.decode(v[0]), URLDecoder.decode(v[1]));
            } else {
                params.putString(URLDecoder.decode(v[0]), " ");
            }/*from   www  .ja v a  2  s .c  om*/
        }
    }
    return params;
}

From source file:org.openhab.habdroid.ui.OpenHABDiscoveryFragment.java

public static OpenHABDiscoveryFragment newInstance(String baseUrl, String username, String password) {
    OpenHABDiscoveryFragment fragment = new OpenHABDiscoveryFragment();
    Bundle args = new Bundle();
    args.putString(ARG_USERNAME, username);
    args.putString(ARG_PASSWORD, password);
    args.putString(ARG_BASEURL, baseUrl);
    fragment.setArguments(args);//from w  w w .j a  v a2  s. c o m
    return fragment;
}

From source file:com.mikecorrigan.trainscorekeeper.FragmentSummary.java

public static FragmentSummary newInstance(int index, JSONObject jsonSpec) {
    Log.vc(VERBOSE, TAG, "newInstance: jsonTab=" + jsonSpec);

    FragmentSummary fragment = new FragmentSummary();
    Bundle args = new Bundle();
    args.putInt(ARG_INDEX, index);/*from w w w .j ava2s .  co m*/
    args.putString(ARG_TAB_SPEC, jsonSpec.toString());
    fragment.setArguments(args);
    return fragment;
}

From source file:Main.java

@Deprecated
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 {
                if (v.length == 2) {
                    params.putString(URLDecoder.decode(v[0], UTF8), URLDecoder.decode(v[1], UTF8));
                } else if (v.length == 1) {
                    params.putString(URLDecoder.decode(v[0], UTF8), "");
                }/*w w  w .  j av a 2s.  c om*/
            } catch (UnsupportedEncodingException e) {
                // shouldn't happen
            }
        }
    }
    return params;
}

From source file:com.miz.mizuu.fragments.MovieDiscoveryFragment.java

public static MovieDiscoveryFragment newInstance(String type, String json, String baseUrl) {
    MovieDiscoveryFragment pageFragment = new MovieDiscoveryFragment();
    Bundle bundle = new Bundle();
    bundle.putString("type", type);
    bundle.putString("json", json);
    bundle.putString("baseUrl", baseUrl);
    pageFragment.setArguments(bundle);/*from   w  ww.ja v  a2 s.  c  o m*/
    return pageFragment;
}