List of usage examples for android.os Bundle Bundle
public Bundle()
From source file:com.amaze.filemanager.services.ExtractService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Bundle b = new Bundle(); b.putInt("id", startId); epath = PreferenceManager.getDefaultSharedPreferences(this).getString("extractpath", ""); mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); String file = intent.getStringExtra("zip"); eentries = intent.getBooleanExtra("entries1", false); if (eentries) { entries = intent.getStringArrayListExtra("entries"); }/*from w w w.j av a 2 s . c om*/ b.putString("file", file); DataPackage intent1 = new DataPackage(); intent1.setName(file); intent1.setTotal(0); intent1.setDone(0); intent1.setId(startId); intent1.setP1(0); intent1.setCompleted(false); hash1.put(startId, intent1); Intent notificationIntent = new Intent(this, MainActivity.class); notificationIntent.setAction(Intent.ACTION_MAIN); notificationIntent.putExtra("openprocesses", true); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); mBuilder = new NotificationCompat.Builder(cd); mBuilder.setContentIntent(pendingIntent); mBuilder.setContentTitle(getResources().getString(R.string.extracting)) .setContentText(new File(file).getName()).setSmallIcon(R.drawable.ic_doc_compressed); hash.put(startId, true); new Doback().execute(b); return START_STICKY; }
From source file:com.thunder.iap.IAPActivity.java
/** * * @param skuList the list of available skus * @param listener/* w w w . jav a 2 s . co m*/ */ public void getSkuDetails(final ArrayList<String> skuList, final SkuDetailsListener listener) { new Thread(new Runnable() { @Override public void run() { Bundle querySkus = new Bundle(); querySkus.putStringArrayList("ITEM_ID_LIST", skuList); try { Bundle skuDetails = mService.getSkuDetails(3, getPackageName(), "inapp", querySkus); ArrayList<JSONObject> result = new ArrayList<JSONObject>(); int response = skuDetails.getInt("RESPONSE_CODE"); if (response == 0) { ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST"); for (String thisResponse : responseList) { JSONObject object = null; try { object = new JSONObject(thisResponse); } catch (JSONException e) { e.printStackTrace(); } //String sku = object.getString("productId"); //String price = object.getString("price"); //if (sku.equals("premiumUpgrade")) mPremiumUpgradePrice = price; //else if (sku.equals("gas")) mGasPrice = price; result.add(object); } listener.onResult(result); } else { listener.onServerError(skuDetails); } } catch (RemoteException e) { e.printStackTrace(); listener.onError(e); } } }).start(); }
From source file:com.group7.dragonwars.GameActivity.java
public final void endGame() { setContentView(R.layout.loading_screen); Intent intent = new Intent(this, Results.class); Bundle b = new Bundle(); b.putString("winnerName", state.getWinner().getName()); b.putInt("turns", state.getTurns()); Statistics stats = state.getStatistics(); Double damageDealt = stats.getStatistic("Damage dealt"); Double damageReceived = stats.getStatistic("Damage received"); Double distanceTravelled = stats.getStatistic("Distance travelled"); Integer goldCollected = stats.getStatistic("Gold received").intValue(); Integer unitsKilled = stats.getStatistic("Units killed").intValue(); Integer unitsMade = stats.getStatistic("Units produced").intValue(); Database db = new Database(getApplicationContext()); db.AddEntry(damageDealt, damageReceived, distanceTravelled, goldCollected, unitsKilled, unitsMade); db.Close();/* w w w.ja va2s .co m*/ for (Map.Entry<String, Double> ent : stats.getEntrySet()) { b.putDouble(ent.getKey(), ent.getValue().doubleValue()); } intent.putExtras(b); startActivity(intent); finish(); }
From source file:de.kirchnerei.bicycle.battery.BatteryDetailFragment.java
private void doEditBatteryClick() { Bundle args = new Bundle(); args.putInt(BatteryDefine.PARAM_BATTERY_ID, mId); getMiddlewareHandler().onAction(R.string.fragment_battery_edit, args); }
From source file:com.android.volley.toolbox.AndroidAuthenticatorTest.java
@Test public void goodToken() throws Exception { Bundle bundle = new Bundle(); bundle.putString(AccountManager.KEY_AUTHTOKEN, "monkey"); when(mAccountManager.getAuthToken(mAccount, "cooltype", false, null, null)).thenReturn(mFuture); when(mFuture.getResult()).thenReturn(bundle); when(mFuture.isDone()).thenReturn(true); when(mFuture.isCancelled()).thenReturn(false); Assert.assertEquals("monkey", mAuthenticator.getAuthToken()); }
From source file:com.clearcenter.mobile_demo.mdAuthenticator.java
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) throws NetworkErrorException { Log.v(TAG, "getAuthToken()"); // If the caller requested an authToken type we don't support, then // return an error if (!authTokenType.equals(mdConstants.AUTHTOKEN_TYPE)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; }//from www . j av a 2 s . c o m // Extract the username and password from the Account Manager, and ask // the server for an appropriate AuthToken. final AccountManager am = AccountManager.get(ctx); final String password = am.getPassword(account); final String hostname = am.getUserData(account, "hostname"); final String username = am.getUserData(account, "username"); if (password != null) { try { mdSSLUtil.DisableSecurity(); final String authToken = mdRest.Login(hostname, username, null, password); if (!TextUtils.isEmpty(authToken)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, mdConstants.ACCOUNT_TYPE); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; } } catch (JSONException e) { Log.e(TAG, "JSONException", e); } catch (GeneralSecurityException e) { Log.e(TAG, "GeneralSecurityException", e); } } Log.v(TAG, "Asking for password again..."); // If we get here, then we couldn't access the user's password - so we // need to re-prompt them for their credentials. We do that by creating // an intent to display our mdAuthenticatorActivity panel. final Intent intent = new Intent(ctx, mdAuthenticatorActivity.class); intent.putExtra(mdAuthenticatorActivity.PARAM_NICKNAME, account.name); intent.putExtra(mdAuthenticatorActivity.PARAM_USERNAME, username); intent.putExtra(mdAuthenticatorActivity.PARAM_HOSTNAME, hostname); intent.putExtra(mdAuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(mdAuthenticatorActivity.PARAM_CONFIRM_CREDENTIALS, true); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.facebook.android.FriendsList.java
@Override @SuppressWarnings("deprecation") public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) { try {//w ww . java2 s.co m final long friendId; if (graph_or_fql.equals("graph")) { friendId = jsonArray.getJSONObject(position).getLong("id"); } else { friendId = jsonArray.getJSONObject(position).getLong("uid"); } String name = jsonArray.getJSONObject(position).getString("name"); new AlertDialog.Builder(this).setTitle(R.string.post_on_wall_title) .setMessage(String.format(getString(R.string.post_on_wall), name)) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Bundle params = new Bundle(); /* * Source Tag: friend_wall_tag To write on a friend's wall, * provide friend's UID in the 'to' parameter. * More info on feed dialog: * https://developers.facebook.com/docs/reference/dialogs/feed/ */ params.putString("to", String.valueOf(friendId)); params.putString("caption", getString(R.string.app_name)); params.putString("description", getString(R.string.app_desc)); params.putString("picture", Utility.HACK_ICON_URL); params.putString("name", getString(R.string.app_action)); Utility.mFacebook.dialog(FriendsList.this, "feed", params, new PostDialogListener()); } }).setNegativeButton(R.string.no, null).show(); } catch (JSONException e) { showToast("Error: " + e.getMessage()); } }
From source file:com.easy.facebook.android.apicall.FQL.java
public Friend getFriend(String uid) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("method", "fql.query"); params.putString("access_token", facebook.getAccessToken()); String fqlQuery = (new StringBuilder( "SELECT uid, name, pic, profile_update_time, timezone, birthday_date, status, online_presence, locale, profile_url, website, is_blocked FROM user WHERE uid=")) .append(uid).toString(); params.putString("query", fqlQuery); String jsonResponse;/*from ww w .j a v a 2 s .c o m*/ try { jsonResponse = Util.openUrl("https://api.facebook.com/restserver.php", "POST", params); JSONObjectDecode jsonArray = new JSONObjectDecode(jsonResponse); return jsonArray.getFriend(0); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } }
From source file:com.marianhello.bgloc.Config.java
public void writeToParcel(Parcel out, int flags) { out.writeFloat(getStationaryRadius()); out.writeInt(getDistanceFilter());// w w w. j a v a 2 s . c o m out.writeInt(getDesiredAccuracy()); out.writeValue(isDebugging()); out.writeString(getNotificationTitle()); out.writeString(getNotificationText()); out.writeString(getLargeNotificationIcon()); out.writeString(getSmallNotificationIcon()); out.writeString(getNotificationIconColor()); out.writeValue(getStopOnTerminate()); out.writeValue(getStartOnBoot()); out.writeValue(getStartForeground()); out.writeInt(getLocationProvider()); out.writeInt(getInterval()); out.writeInt(getFastestInterval()); out.writeInt(getActivitiesInterval()); out.writeValue(getStopOnStillActivity()); out.writeString(getUrl()); out.writeString(getSyncUrl()); out.writeInt(getSyncThreshold()); out.writeInt(getMaxLocations()); Bundle bundle = new Bundle(); bundle.putSerializable("httpHeaders", getHttpHeaders()); out.writeBundle(bundle); }
From source file:luis.clientebanco.OAuth.Utils.java
/** * Parse a URL query and fragment parameters into a key-value bundle. * /*from w w w .j a v a 2 s .co m*/ * @param url the URL to parse * @return a dictionary bundle of keys and values */ public static Bundle parseUrl(String url) { // hack to prevent MalformedURLException url = url.replace("fbconnect", "http"); url = url.replace("moneyvault", "http"); try { URL u = new URL(url); Bundle b = decodeUrl(u.getQuery()); b.putAll(decodeUrl(u.getRef())); return b; } catch (MalformedURLException e) { return new Bundle(); } }