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.facebook.LegacyTokenHelper.java

public static void putApplicationId(Bundle bundle, String value) {
    Validate.notNull(bundle, "bundle");
    bundle.putString(APPLICATION_ID_KEY, value);
}

From source file:bolts.MeasurementEvent.java

/**
 *  Broadcast Bolts measurement event./*from w w w . j  a  v  a 2 s .co m*/
 *  Bolts raises events to the application with this method by sending
 *  {@link #MEASUREMENT_EVENT_NOTIFICATION_NAME} broadcast.
 *
 *  @param context the context of activity or application who is going to send the event. required.
 *  @param name the event name that is going to be sent. required.
 *  @param intent the intent that carries the logging data in its extra bundle and data url. optional.
 *  @param extraLoggingData other logging data to be sent in events argument. optional.
 *
 */
static void sendBroadcastEvent(Context context, String name, Intent intent,
        Map<String, String> extraLoggingData) {
    Bundle logData = new Bundle();
    if (intent != null) {
        Bundle applinkData = AppLinks.getAppLinkData(intent);
        if (applinkData != null) {
            logData = getApplinkLogData(context, name, applinkData, intent);
        } else {
            Uri intentUri = intent.getData();
            if (intentUri != null) {
                logData.putString("intentData", intentUri.toString());
            }
            Bundle intentExtras = intent.getExtras();
            if (intentExtras != null) {
                for (String key : intentExtras.keySet()) {
                    Object o = intentExtras.get(key);
                    String logValue = objectToJSONString(o);
                    logData.putString(key, logValue);
                }
            }
        }
    }

    if (extraLoggingData != null) {
        for (String key : extraLoggingData.keySet()) {
            logData.putString(key, extraLoggingData.get(key));
        }
    }
    MeasurementEvent event = new MeasurementEvent(context, name, logData);
    event.sendBroadcast();
}

From source file:Main.java

/**
 * @param url/*from  w ww .jav a 2  s  .c  o  m*/
 * @return bundle that contains key-value entries of the url query and fragment.
 */
public static final Bundle getUrlParameters(final String url) {
    final Bundle bundle = new Bundle();
    final String[] separated = url.split("\\?");
    if (separated.length > 1) {
        final String query = separated[1];
        final String[] params = query.split("[&#]");
        for (final String param : params) {
            final String[] keyvalue = param.split("=");
            final String key = URLDecoder.decode(keyvalue[0]);
            String value = null;
            if (keyvalue.length > 1) {
                value = URLDecoder.decode(keyvalue[1]);
            }
            bundle.putString(key, value);
        }
    }
    return bundle;
}

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

public static OpenHABWidgetListFragment withPage(String pageUrl, String baseUrl, String rootUrl,
        String username, String password, int position) {
    Log.d(TAG, "withPage(" + pageUrl + ")");
    OpenHABWidgetListFragment fragment = new OpenHABWidgetListFragment();
    Bundle args = new Bundle();
    args.putString("displayPageUrl", pageUrl);
    args.putString("openHABBaseUrl", baseUrl);
    args.putString("sitemapRootUrl", rootUrl);
    args.putString("openHABUsername", username);
    args.putString("openHABPassword", password);
    args.putInt("position", position);
    fragment.setArguments(args);/*w w  w  .  j a v a 2  s  . co  m*/
    return fragment;
}

From source file:it.scoppelletti.mobilepower.app.HelpDialogFragment.java

/**
 * Istanzia un frammento.//from w  w w .  j  a v  a 2s . c o m
 * 
 * @param  mode    Modalit&agrave;.
 * @param  titleId Identificatore della risorsa del titolo.
 * @param  textId  Identificatore della risorsa del testo.
 * @param  prefKey Chiave della preferenza che indica se la Guida &egrave;
 *                 gi&agrave; stata visualizzata.
 * @return         Frammento.
 */
public static HelpDialogFragment newInstance(int mode, int titleId, int textId, String prefKey) {
    Bundle args;
    HelpDialogFragment fragment;

    if (StringUtils.isBlank(prefKey)) {
        throw new NullPointerException("Argument prefKey is null.");
    }

    args = new Bundle();
    args.putInt(HelpDialogFragment.ARG_MODE, mode);
    args.putInt(HelpDialogFragment.ARG_TITLEID, titleId);
    args.putInt(HelpDialogFragment.ARG_TEXTID, textId);
    args.putString(HelpDialogFragment.ARG_PREFKEY, prefKey);

    fragment = new HelpDialogFragment();
    fragment.setArguments(args);

    return fragment;
}

From source file:com.ryan.ryanreader.fragments.PostListingFragment.java

public static PostListingFragment newInstance(final RedditSubreddit subreddit, final URI url,
        final UUID session, final CacheRequest.DownloadType downloadType) {

    final PostListingFragment f = new PostListingFragment();

    final Bundle bundle = new Bundle(4);

    bundle.putParcelable("subreddit", subreddit);
    bundle.putString("url", url.toString());
    if (session != null)
        bundle.putString("session", session.toString());
    bundle.putString("downloadType", downloadType.name());

    f.setArguments(bundle);//from  w  w  w .j  a  va2  s .c  o m

    return f;
}

From source file:com.versobit.kmark.clarity.DbProcessorFragment.java

public static DbProcessorFragment newInstance(String reportsTo, boolean dryRun, boolean backups,
        boolean reboot) {
    DbProcessorFragment frag = new DbProcessorFragment();
    Bundle args = new Bundle();
    args.putString(ARG_REPORTS_TO, reportsTo);
    args.putBoolean(ARG_DRY_RUN, dryRun);
    args.putBoolean(ARG_RETAIN_BACKUPS, backups);
    args.putBoolean(ARG_SOFT_REBOOT, reboot);
    frag.setArguments(args);/* w  w w  .ja va  2  s.c om*/
    return frag;
}

From source file:com.facebook.LegacyTokenHelper.java

public static void putToken(Bundle bundle, String value) {
    Validate.notNull(bundle, "bundle");
    Validate.notNull(value, "value");
    bundle.putString(TOKEN_KEY, value);
}

From source file:com.max2idea.android.fwknop.Fwknop.java

public static void sendHandlerMessage(Handler handler, int message_type, String message_var,
        String message_value) {//from  w  w w  .  ja va  2  s . c  o m
    Message msg1 = handler.obtainMessage();
    Bundle b = new Bundle();
    b.putInt("message_type", message_type);
    b.putString(message_var, message_value);
    msg1.setData(b);
    handler.sendMessage(msg1);
}

From source file:com.sunho.nating.fragments.DetailPlaceFragment.java

/**
 * Create a new instance of DetailFragment.
 *
 * @param resourceId The resource ID of the Drawable image to show
 * @param title The title of the image//from   w ww.  j  a v  a2 s  . c om
 * @param x The horizontal position of the grid item in pixel
 * @param y The vertical position of the grid item in pixel
 * @param width The width of the grid item in pixel
 * @param height The height of the grid item in pixel
 * @return a new instance of DetailFragment
 */
public static DetailPlaceFragment newInstance(int resourceId, String title, int x, int y, int width, int height,
        int position, String locationLat, String locationLong) {
    myLocationLat = locationLat;
    myLocationLong = locationLong;
    intentPosition = position;
    DetailPlaceFragment fragment = new DetailPlaceFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_RESOURCE_ID, resourceId);
    args.putString(ARG_TITLE, title);
    args.putInt(ARG_X, x);
    args.putInt(ARG_Y, y);
    args.putInt(ARG_WIDTH, width);
    args.putInt(ARG_HEIGHT, height);
    fragment.setArguments(args);
    return fragment;
}