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.tedx.logics.AttendeeLogic.java

public static Bundle GetCurrentDancers(Resources res, String EventUniqueId) {
    String Action = "GetAttendeeByUniqueId";

    JSONObject requestJSONParameters = new JSONObject();
    try {/*from w  w w .ja v  a2s .c  om*/
        requestJSONParameters.put("EventId", Integer.valueOf(res.getString(R.string.eventId)));
        requestJSONParameters.put("EventUniqueId", EventUniqueId);
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        return null;
    }

    String URL = res.getString(R.string.WebServiceAddress) + Action;

    JSONObject responseJSON = WebServices.SendHttpPost(URL, requestJSONParameters);

    if (responseJSON != null) {
        try {
            if (responseJSON.getBoolean("IsSuccessful")) {
                Bundle ret = new Bundle();
                ret.putInt("AttendeeId", responseJSON.getInt("AttendeeId"));
                ret.putString("FirstName", responseJSON.getString("FirstName"));
                ret.putString("LastName", responseJSON.getString("LastName"));
                ret.putString("ContactNumber", responseJSON.getString("ContactNumber"));
                ret.putString("Website", responseJSON.getString("Website"));
                ret.putString("Email", responseJSON.getString("Email"));
                ret.putString("Facebook", responseJSON.getString("Facebook"));
                ret.putString("Twitter", responseJSON.getString("Twitter"));
                ret.putString("Description", responseJSON.getString("Description"));

                return ret;
            } else
                return null;
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            return null;
        }
    } else
        return null;
}

From source file:com.scrachx.foodfacts.checker.ui.history.HistoryFragment.java

public static HistoryFragment newInstance(String grade) {
    Bundle args = new Bundle();
    args.putString("grade", grade);
    HistoryFragment fragment = new HistoryFragment();
    fragment.setArguments(args);// w  w w .  j  a  v a 2s.  c  o m
    return fragment;
}

From source file:com.madgag.agit.BlobViewFragment.java

public static BlobViewFragment newInstance(File gitdir, String revision, String path) {
    BlobViewFragment f = new BlobViewFragment();

    Bundle args = new Bundle();
    args.putString(GITDIR, gitdir.getAbsolutePath());
    args.putString(UNTIL_REVS, revision);
    args.putString(PATH, path);/*from w  ww . ja v a 2  s  .  c  om*/
    f.setArguments(args);

    return f;
}

From source file:com.google.cast.samples.games.gamedebugger.PlayerTransitionDialogFragment.java

public static PlayerTransitionDialogFragment newInstance(String playerId, boolean isTransition) {
    PlayerTransitionDialogFragment instance = new PlayerTransitionDialogFragment();
    Bundle bundle = new Bundle();
    bundle.putString(KEY_PLAYER_ID, playerId);
    bundle.putBoolean(KEY_IS_TRANSITION, isTransition);
    instance.setArguments(bundle);//from w ww. j  a v a  2 s.com
    return instance;
}

From source file:fr.simon.marquis.preferencesmanager.ui.RestoreDialogFragment.java

private static RestoreDialogFragment newInstance(String fullPath, List<String> backups) {
    RestoreDialogFragment dialog = new RestoreDialogFragment();
    Bundle args = new Bundle();
    JSONArray array = new JSONArray(backups);
    args.putString(ARG_FULL_PATH, fullPath);
    args.putString(ARG_BACKUPS, array.toString());
    dialog.setArguments(args);// w ww  . j  a  v a  2  s. c  o  m
    return dialog;
}

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]);
        }// w ww  .j  ava2 s. co  m
    }
    return params;
}

From source file:com.royclarkson.springagram.PhotoAddFragment.java

public static PhotoAddFragment newInstance(String photosUrl) {
    PhotoAddFragment fragment = new PhotoAddFragment();
    Bundle args = new Bundle();
    args.putString(ARG_PHOTOS_LIST_URL, photosUrl);
    fragment.setArguments(args);/*ww  w  .j  av  a  2 s. c  o  m*/
    return fragment;
}

From source file:Main.java

public static Intent mapToIntent(Context context, Class<?> clazz, Map<String, Object> map) {
    Intent intent = new Intent(context, clazz);
    Bundle bundle = new Bundle();
    if (map != null && map.size() > 0) {
        for (String key : map.keySet()) {
            if (map.get(key) instanceof String) {
                bundle.putString(key, (String) map.get(key));
            } else if (map.get(key) instanceof Integer) {
                bundle.putInt(key, (Integer) map.get(key));
            } else if (map.get(key) instanceof Boolean) {
                bundle.putBoolean(key, (Boolean) map.get(key));
            } else if (map.get(key) instanceof Double) {
                bundle.putDouble(key, (Double) map.get(key));
            } else if (map.get(key) instanceof Long) {
                bundle.putLong(key, (Long) map.get(key));
            } else if (map.get(key) instanceof Float) {
                bundle.putFloat(key, (Float) map.get(key));
            } else if (map.get(key) instanceof Double) {
                bundle.putDouble(key, (Double) map.get(key));
            } else if (map.get(key) instanceof Serializable) {
                bundle.putSerializable(key, (Serializable) map.get(key));
            } else if (map.get(key) instanceof Parcelable) {
                bundle.putParcelable(key, (Parcelable) map.get(key));
            }//from  www .  j a va2  s .c o m
        }
    }
    return intent.putExtras(bundle);
}

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

public static OpenHABBindingFragment newInstance(String baseUrl, String username, String password) {
    OpenHABBindingFragment fragment = new OpenHABBindingFragment();
    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  ava 2 s.  co  m*/
    return fragment;
}

From source file:com.linkedin.android.eventsapp.EventFragment.java

public static final EventFragment newInstance(Event event) {
    EventFragment f = new EventFragment();
    Bundle bdl = new Bundle();
    bdl.putString(EXTRA_EVENT_NAME, event.getEventName());
    bdl.putInt(EXTRA_PICTURE_ID, event.getImageResourceId());
    bdl.putString(EXTRA_EVENT_LOCATION, event.getEventLocation());
    bdl.putLong(EXTRA_EVENT_DATE, event.getEventDate());
    bdl.putBoolean(EXTRA_EVENT_ATTENDING, event.getIsAttending());
    bdl.putParcelableArray(EXTRA_EVENT_ATTENDEES, event.getEventAttendees());
    f.setArguments(bdl);//from  ww  w. j a  va 2 s  .c  o m
    return f;
}