List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:Main.java
public static void PrintLog(String text) { if (mHandler != null) { Message meg = new Message(); Bundle bundel = new Bundle(); bundel.putString("MESSAGE", text); meg.setData(bundel);//from w ww . j av a2 s. co m mHandler.sendMessage(meg); } }
From source file:Main.java
public static void sendMessageHandler(Handler handler, int what, String key, String value) { Message message = new Message(); message.what = what;// ww w. ja v a2 s . com Bundle bundle = new Bundle(); bundle.putString(key, value); message.setData(bundle); handler.sendMessage(message); }
From source file:Main.java
public static <E extends Enum<?>> void putEnum(Bundle b, String key, E value) { if (value == null) { b.putString(key + NAME, NO_NAME); } else {//from w ww .j a v a 2s. co m b.putString(key + NAME, value.getDeclaringClass().getName()); b.putString(key, value.name()); } }
From source file:Main.java
/** * Create a Parcelable Bundle containing 3 parameters: String, int, int for transport from the test package engine.<br> * It will be used by {@link Message#setData(Bundle)} for sending a part of whole message from engine.<br> * The String message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_ID} as the key for the item.<br> * The int message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_INDEX} as the key for the item.<br> * The int message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_TOTALNUMBER} as the key for the item.<br> * /*from w ww . ja v a 2 s. c o m*/ * @param ID String, the message's ID. * @param index int, the index of this parcel of the whole message. * @param totalNumber int, indicate the total number of parcels will be sent for a whole message.. * @return Parcelable Bundle * @see Bundle#putCharArray(String, char[]) * @see Bundle#getCharArray(String) * @see #getParcelableIDFromSmallParcel(Parcelable) * @see #getParcelableIndexFromSmallParcel(Parcelable) * @see #getParcelableTotalNumberFromSmallParcel(Parcelable) * @see #isSmallParcelOfWholeMessage(Bundle) */ public static Bundle setBundleOfSmallParcel(String ID, int index, int totalNumber) { Bundle bundle = new Bundle(); bundle.putString(BUNDLE_SMALL_PARCEL_ID, ID); bundle.putInt(BUNDLE_SMALL_PARCEL_INDEX, index); bundle.putInt(BUNDLE_SMALL_PARCEL_TOTALNUMBER, totalNumber); bundle.setClassLoader(Bundle.class.getClassLoader()); return bundle; }
From source file:Main.java
public static Bundle mapToBundle(Map<String, String> map) { Bundle bundle = new Bundle(); for (String key : map.keySet()) { bundle.putString(key, map.get(key)); }/*from ww w. j a v a 2 s . com*/ return bundle; }
From source file:Main.java
public static Bundle toBundle(Map<String, String> input) { Bundle output = new Bundle(); for (String key : input.keySet()) { output.putString(key, input.get(key)); }/*from w ww. j av a 2 s . co m*/ return output; }
From source file:Main.java
public static void sendMsg2Client(String sKey, String sObjParam, int iMsg) { Bundle extras = new Bundle(); extras.putString(sKey, sObjParam); sendMsg2Client(iMsg, 0, 0, extras);// w w w. j a v a2 s . c o m }
From source file:Main.java
public static Bundle decodeUrl(String s) { Bundle params = new Bundle(); if (s != null) { params.putString("url", s); String array[] = s.split("&"); for (String parameter : array) { String v[] = parameter.split("="); if (v.length > 1) params.putString(v[0], URLDecoder.decode(v[1])); }/* ww w . j a v a 2s .c om*/ } return params; }
From source file:com.clockworkmod.billing.BillingReceiver.java
static Bundle makeRequestBundle(Context context, String method) { Bundle request = new Bundle(); request.putString(Consts.BILLING_REQUEST_METHOD, method); request.putInt(Consts.BILLING_REQUEST_API_VERSION, 1); request.putString(Consts.BILLING_REQUEST_PACKAGE_NAME, context.getPackageName()); return request; }
From source file:Main.java
/** * Create a account for the sync adapter. * * @param _context The application context. * @return the new created Account.//from w w w .j av a2 s. co m */ public static Account createSyncAccount(Context _context, String _username) { // create a new a account. Account newAccount = new Account(_username, ACCOUNT_TYPE); AccountManager accountManager = (AccountManager) _context.getSystemService(Context.ACCOUNT_SERVICE); Account[] accounts = accountManager.getAccountsByType(ACCOUNT_TYPE); for (Account account : accounts) { if (account.equals(newAccount)) { // account already exists return null; } } // try to login and retrieve the token Bundle bundle = new Bundle(); bundle.putString("Token", "some auth token please"); if (accountManager.addAccountExplicitly(newAccount, null, bundle)) { } else { Log.i(TAG, "createSyncAccount: account already exists or an error happened"); } return newAccount; }