List of usage examples for android.os Bundle Bundle
public Bundle()
From source file:br.liveo.ndrawer.ui.fragment.MainFragment21.java
public static MainFragment21 newInstance(String text) { MainFragment21 mFragment = new MainFragment21(); mBundle = new Bundle(); mBundle.putString(TEXT_FRAGMENT, text); mFragment.setArguments(mBundle);// w ww .j av a2s . c o m return mFragment; }
From source file:com.savvywits.wethepeople.RESTResultFragment.java
public static RESTResultFragment newInstance(String string) { RESTResultFragment fragment = new RESTResultFragment(); Bundle bundle = new Bundle(); bundle.putString("result_string", string); fragment.setArguments(bundle);//ww w . j a v a 2s . c om return fragment; }
From source file:com.catchoom.api.CatchoomSearchResponseItem.java
/** * Parse a {@link CatchoomSearchResponseItem} from a {@link JSONObject}. * @param json The json to parse./*from w w w. ja v a 2 s .com*/ * @return The {@link CatchoomSearchResponseItem} parsed. */ static CatchoomSearchResponseItem parseFromJSON(JSONObject json) { try { if (json.has("item_id") && json.has("score")) { String parsedItemId = json.getString("item_id"); int parsedScore = json.getInt("score"); JSONObject rawMetadata = json.getJSONObject("metadata"); Bundle parsedMetadata = new Bundle(); if (null != rawMetadata) { Iterator<?> metadataKeys = rawMetadata.keys(); while (metadataKeys.hasNext()) { String key = (String) metadataKeys.next(); parsedMetadata.putString(key, rawMetadata.getString(key)); } } return new CatchoomSearchResponseItem(parsedItemId, parsedScore, parsedMetadata); } else { return null; } } catch (JSONException e) { e.printStackTrace(); } return null; }
From source file:com.facebook.share.internal.WebDialogParameters.java
public static Bundle create(AppGroupCreationContent appGroupCreationContent) { Bundle webParams = new Bundle(); Utility.putNonEmptyString(webParams, ShareConstants.WEB_DIALOG_PARAM_NAME, appGroupCreationContent.getName()); Utility.putNonEmptyString(webParams, ShareConstants.WEB_DIALOG_PARAM_DESCRIPTION, appGroupCreationContent.getDescription()); Utility.putNonEmptyString(webParams, ShareConstants.WEB_DIALOG_PARAM_PRIVACY, appGroupCreationContent.getAppGroupPrivacy().toString().toLowerCase(Locale.ENGLISH)); return webParams; }
From source file:palamarchuk.smartlife.app.fragments.ProfileFragment.java
public static ProfileFragment newInstance(UserInfo userInfo) { ProfileFragment profileFragment = new ProfileFragment(); Bundle bundle = new Bundle(); bundle.putParcelable(UserInfo.PARCELABLE_KEY, userInfo); profileFragment.setArguments(bundle); return profileFragment; }
From source file:com.chess.genesis.data.GameParser.java
public static Bundle parse(final JSONObject data) { final Bundle game = new Bundle(); try {/*from www .j a v a2 s .c o m*/ game.putInt("gametype", Enums.GameType(data.optString("gametype", "genesis"))); } catch (final RuntimeException e) { game.putInt("gametype", Enums.GENESIS_CHESS); } try { game.putInt("opponent", Enums.OpponentType(data.optString("opponent", "human"))); } catch (final RuntimeException e) { game.putInt("opponent", Enums.HUMAN_OPPONENT); } game.putString("name", data.optString("name", "untitled")); game.putLong("ctime", data.optLong("ctime", System.currentTimeMillis())); game.putLong("stime", data.optLong("stime", System.currentTimeMillis())); final GamePosition pos = parsePosition(data.optString("history", " "), game.getInt("gametype")); game.putString("history", pos.history); game.putString("zfen", pos.zfen); return game; }
From source file:com.mobilesolutionworks.android.twitter.TwitterPluginFragment.java
public static TwitterPluginFragment create(String consumerKey, String consumerSecret) { Bundle args = new Bundle(); args.putString("consumerKey", consumerKey); args.putString("consumerSecret", consumerSecret); TwitterPluginFragment fragment = new TwitterPluginFragment(); fragment.setArguments(args);/*from www .j a v a2 s.c om*/ return fragment; }
From source file:com.hat.tools.HttpUtils.java
public static void SendRequest(String url, Handler handler) { HttpGet request = new HttpGet(url); HttpClient httpClient = new DefaultHttpClient(); byte[] data = null; InputStream in = null;/* w ww. j av a2 s. co m*/ try { HttpResponse response = httpClient.execute(request); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { ByteArrayOutputStream out = new ByteArrayOutputStream(); in = response.getEntity().getContent(); byte[] buf = new byte[1024]; int len = 0; while ((len = in.read(buf)) != -1) { out.write(buf, 0, len); } data = out.toByteArray(); Message msg = new Message(); msg.what = HTTP_FINISH; Bundle bundle = new Bundle(); bundle.putByteArray("data", data); msg.setData(bundle); handler.sendMessage(msg); out.close(); } } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { if (in != null) in.close(); } catch (IOException e) { e.printStackTrace(); } } }
From source file:com.mikecorrigan.trainscorekeeper.FragmentButton.java
public static FragmentButton newInstance(int index, JSONObject jsonTab) { Log.vc(VERBOSE, TAG, "newInstance: jsonTab=" + jsonTab); FragmentButton fragment = new FragmentButton(); Bundle args = new Bundle(); args.putInt(ARG_INDEX, index);/*from w ww . ja v a 2s .com*/ args.putString(ARG_TAB_SPEC, jsonTab.toString()); fragment.setArguments(args); return fragment; }
From source file:com.manning.androidhacks.hack047.fragments.ColorFragment.java
public static ColorFragment newInstance(int color, String text) { final ColorFragment fragment = new ColorFragment(); Bundle args = new Bundle(); args.putInt(COLOR_KEY, color);/*from w ww . j av a2s . c om*/ args.putString(TEXT_KEY, text); fragment.setArguments(args); return fragment; }