List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:com.raspi.chatapp.ui.chatting.SendImageFragment.java
/** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param buddyId the buddyId to whom the image should be sent * @param name the name of the chat * @param imageUris the imageUris representing the images that are added * @return A new instance of fragment SendImageFragment. *//*from ww w . java 2 s .co m*/ public static SendImageFragment newInstance(String buddyId, String name, Parcelable... imageUris) { SendImageFragment fragment = new SendImageFragment(); Bundle args = new Bundle(); args.putParcelableArray(Constants.IMAGE_URI, imageUris); args.putString(Constants.BUDDY_ID, buddyId); args.putString(Constants.CHAT_NAME, name); fragment.setArguments(args); return fragment; }
From source file:com.facebook.share.ShareApi.java
private static void putImageInBundleWithArrayFormat(Bundle parameters, int index, JSONObject image) throws JSONException { Iterator<String> keys = image.keys(); while (keys.hasNext()) { String property = keys.next(); String key = String.format(Locale.ROOT, "image[%d][%s]", index, property); parameters.putString(key, image.get(property).toString()); }// w w w . jav a 2s . c om }
From source file:ee.ioc.phon.android.speak.RecognizerIntentActivity.java
private static Message createMessage(int type, String str) { Bundle b = new Bundle(); b.putString(MSG, str); Message msg = Message.obtain();//from w w w . j a v a 2 s . c o m msg.what = type; msg.setData(b); return msg; }
From source file:com.vmihalachi.turboeditor.fragment.EditorFragment.java
public static EditorFragment newInstance(String filePath) { EditorFragment frag = new EditorFragment(); Bundle args = new Bundle(); args.putString("filePath", filePath); frag.setArguments(args);/*from w ww . j a v a 2s.com*/ return frag; }
From source file:com.microsoft.onedrive.apiexplorer.ItemFragment.java
/** * Create a new instance of ItemFragment * @param itemId The item id to create it for * @return The fragment// w w w .jav a 2s .c o m */ static ItemFragment newInstance(final String itemId) { ItemFragment fragment = new ItemFragment(); Bundle args = new Bundle(); args.putString(ARG_ITEM_ID, itemId); fragment.setArguments(args); return fragment; }
From source file:com.facebook.internal.Utility.java
public static void putObjectInBundle(Bundle bundle, String key, Object value) { if (value instanceof String) { bundle.putString(key, (String) value); } else if (value instanceof Parcelable) { bundle.putParcelable(key, (Parcelable) value); } else if (value instanceof byte[]) { bundle.putByteArray(key, (byte[]) value); } else {/*from w w w . j a va 2s . com*/ throw new FacebookException("attempted to add unsupported type to Bundle"); } }
From source file:com.test.onesignal.GenerateNotificationRunner.java
public static Bundle getBaseNotifBundle(String id) { Bundle bundle = new Bundle(); bundle.putString("alert", notifMessage); bundle.putString("custom", "{\"i\": \"" + id + "\"}"); return bundle; }
From source file:com.facebook.TestSession.java
private static synchronized void retrieveTestAccountsForAppIfNeeded() { if (appTestAccounts != null) { return;/*from w w w. j ava 2s . c o m*/ } appTestAccounts = new HashMap<String, TestAccount>(); // The data we need is split across two different FQL tables. We construct two queries, submit them // together (the second one refers to the first one), then cross-reference the results. // Get the test accounts for this app. String testAccountQuery = String.format("SELECT id,access_token FROM test_account WHERE app_id = %s", testApplicationId); // Get the user names for those accounts. String userQuery = "SELECT uid,name FROM user WHERE uid IN (SELECT id FROM #test_accounts)"; Bundle parameters = new Bundle(); // Build a JSON string that contains our queries and pass it as the 'q' parameter of the query. JSONObject multiquery; try { multiquery = new JSONObject(); multiquery.put("test_accounts", testAccountQuery); multiquery.put("users", userQuery); } catch (JSONException exception) { throw new FacebookException(exception); } parameters.putString("q", multiquery.toString()); // We need to authenticate as this app. parameters.putString("access_token", getAppAccessToken()); Request request = new Request(null, "fql", parameters, null); Response response = request.executeAndWait(); if (response.getError() != null) { throw response.getError().getException(); } FqlResponse fqlResponse = response.getGraphObjectAs(FqlResponse.class); GraphObjectList<FqlResult> fqlResults = fqlResponse.getData(); if (fqlResults == null || fqlResults.size() != 2) { throw new FacebookException("Unexpected number of results from FQL query"); } // We get back two sets of results. The first is from the test_accounts query, the second from the users query. Collection<TestAccount> testAccounts = fqlResults.get(0).getFqlResultSet().castToListOf(TestAccount.class); Collection<UserAccount> userAccounts = fqlResults.get(1).getFqlResultSet().castToListOf(UserAccount.class); // Use both sets of results to populate our static array of accounts. populateTestAccounts(testAccounts, userAccounts); return; }
From source file:com.test.onesignal.GenerateNotificationRunner.java
private static Bundle getBundleWithAllOptionsSet() { Bundle bundle = new Bundle(); bundle.putString("title", "Test H"); bundle.putString("alert", "Test B"); bundle.putString("bgn", "1"); bundle.putString("vis", "0"); bundle.putString("bgac", "FF0000FF"); bundle.putString("from", "703322744261"); bundle.putString("ledc", "FFFFFF00"); bundle.putString("bicon", "big_picture"); bundle.putString("licon", "large_icon"); bundle.putString("sicon", "small_icon"); bundle.putString("sound", "test_sound"); bundle.putString("grp_msg", "You test $[notif_count] MSGs!"); bundle.putString("collapse_key", "a_key"); // GCM sets this to 'do_not_collapse' when not set. bundle.putString("bg_img", "{\"img\": \"test_image_url\"," + "\"tc\": \"FF000000\"," + "\"bc\": \"FFFFFFFF\"}"); bundle.putInt("pri", 10); bundle.putString("custom", "{\"a\": {" + " \"myKey\": \"myValue\"," + " \"nested\": {\"nKey\": \"nValue\"}," + " \"actionButtons\": [{\"id\": \"id1\", \"text\": \"button1\", \"icon\": \"ic_menu_share\"}," + " {\"id\": \"id2\", \"text\": \"button2\", \"icon\": \"ic_menu_send\"}" + " ]," + " \"actionSelected\": \"__DEFAULT__\"" + " }," + "\"u\":\"http://google.com\"," + "\"i\":\"9764eaeb-10ce-45b1-a66d-8f95938aaa51\"" + "}"); return bundle; }
From source file:com.foxykeep.datadroidpoc.data.operation.AuthenticationOperation.java
@Override public Bundle execute(Context context, Request request) throws ConnectionException, DataException { NetworkConnection networkConnection = new NetworkConnection(context, WSConfig.WS_AUTHENTICATION_URL); if (request.getBoolean(PARAM_WITH_AUTHENTICATE)) { networkConnection.setCredentials(new UsernamePasswordCredentials(LOGIN, PASSWD)); }/* w w w.j a v a 2 s . c o m*/ ConnectionResult result = networkConnection.execute(); Bundle bundle = new Bundle(); bundle.putString(PoCRequestFactory.BUNDLE_EXTRA_AUTHENTICATION_RESULT, result.body); return bundle; }