List of usage examples for android.os Bundle getInt
public int getInt(String key)
From source file:fr.cph.stock.android.activity.MainActivity.java
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { // Restore the previously serialized current dropdown position. if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) { getActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM)); }/*from ww w . j a va 2 s . co m*/ }
From source file:fr.cph.chicago.core.activity.BusActivity.java
@Override public void onRestoreInstanceState(final Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); busStopId = savedInstanceState.getInt(bundleBusStopId); busRouteId = savedInstanceState.getString(bundleBusRouteId); bound = savedInstanceState.getString(bundleBusBound); boundTitle = savedInstanceState.getString(bundleBusBoundTitle); busStopName = savedInstanceState.getString(bundleBusStopName); busRouteName = savedInstanceState.getString(bundleBusRouteName); latitude = savedInstanceState.getDouble(bundleBusLatitude); longitude = savedInstanceState.getDouble(bundleBusLongitude); }
From source file:fr.cph.chicago.core.activity.BusActivity.java
@Override protected final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); App.checkBusData(this); if (!this.isFinishing()) { setContentView(R.layout.activity_bus); ButterKnife.bind(this); if (busStopId == null || busRouteId == null || bound == null || busStopName == null || busRouteName == null || boundTitle == null) { final Bundle extras = getIntent().getExtras(); busStopId = extras.getInt(bundleBusStopId); busRouteId = extras.getString(bundleBusRouteId); bound = extras.getString(bundleBusBound); boundTitle = extras.getString(bundleBusBoundTitle); busStopName = extras.getString(bundleBusStopName); busRouteName = extras.getString(bundleBusRouteName); latitude = extras.getDouble(bundleBusLatitude); longitude = extras.getDouble(bundleBusLongitude); }/*from w ww. j a v a 2 s. co m*/ final Position position = new Position(); position.setLatitude(latitude); position.setLongitude(longitude); isFavorite = isFavorite(); mapImage.setColorFilter(grey_5); directionImage.setColorFilter(grey_5); favoritesImageContainer.setOnClickListener(v -> switchFavorite()); if (isFavorite) { favoritesImage.setColorFilter(yellowLineDark); } else { favoritesImage.setColorFilter(grey_5); } scrollView.setOnRefreshListener(() -> new LoadStationDataTask().execute()); streetViewImage.setOnClickListener(new GoogleStreetOnClickListener(latitude, longitude)); mapContainer.setOnClickListener(new GoogleMapOnClickListener(latitude, longitude)); walkContainer.setOnClickListener(new GoogleMapDirectionOnClickListener(latitude, longitude)); busRouteNameView2.setText(busRouteName + " (" + boundTitle + ")"); // Load google street picture and data createGoogleStreetObservable(position.getLatitude(), position.getLongitude()); subscribeToGoogleStreet(streetViewImage, streetViewText); new LoadStationDataTask().execute(); setToolBar(); // Google analytics Util.trackScreen(getApplicationContext(), analyticsBusDetails); } }
From source file:com.tdispatch.passenger.fragment.SearchAddressFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { mType = args.getInt(Const.Bundle.TYPE); mAddress = args.getParcelable(Const.Bundle.LOCATION); } else {/*from w w w . j a va2 s .c o m*/ throw new IllegalArgumentException("Arguments not passed"); } // Check to see if a voice recognition activity is present on device PackageManager pm = mContext.getPackageManager(); List<ResolveInfo> activities = pm .queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); mVoiceSearchAvailable = (activities.size() != 0); }
From source file:com.piusvelte.wapdroid.MapData.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map);//from w w w . ja va 2s. co m mContext = this; mMView = (MapView) findViewById(R.id.mapview); mMView.setBuiltInZoomControls(true); mMController = mMView.getController(); mMController.setZoom(12); Bundle extras = getIntent().getExtras(); if (extras != null) { mNetwork = extras.getInt(WapdroidProvider.TABLE_NETWORKS); mPair = extras.getInt(WapdroidProvider.TABLE_PAIRS); String operator = extras.getString(OPERATOR); if (operator.length() > 0) { mMCC = Integer.parseInt(operator.substring(0, 3)); mMNC = Integer.parseInt(operator.substring(3)); } mCarrier = extras.getString(CARRIER); } color_primary = getResources().getColor(R.color.primary); color_secondary = getResources().getColor(R.color.secondary); drawable_cell = getResources().getDrawable(R.drawable.cell); drawable_network = getResources().getDrawable(R.drawable.network); string_cancel = getString(android.R.string.cancel); string_deleteCell = String.format(getString(R.string.forget), getString(R.string.cell)); string_deleteNetwork = String.format(getString(R.string.forget), getString(R.string.network)); string_cellWarning = getString(R.string.cellwarning); string_cid = getString(R.string.label_CID); string_linefeed = getString(R.string.linefeed); string_lac = getString(R.string.label_LAC); string_range = getString(R.string.range); string_colon = getString(R.string.colon); AdView adView = new AdView(this, AdSize.BANNER, Wapdroid.GOOGLE_AD_ID); ((LinearLayout) findViewById(R.id.ad)).addView(adView); adView.loadAd(new AdRequest()); }
From source file:com.zd.vpn.fragments.AboutFragment.java
private void initGMSDonateOptions() { try {//from w ww. ja v a2s.c o m int billingSupported = mService.isBillingSupported(3, getActivity().getPackageName(), INAPPITEM_TYPE_INAPP); if (billingSupported != BILLING_RESPONSE_RESULT_OK) { Log.i("OpenVPN", "Play store billing not supported"); return; } ArrayList skuList = new ArrayList(); Collections.addAll(skuList, donationSkus); Bundle querySkus = new Bundle(); querySkus.putStringArrayList("ITEM_ID_LIST", skuList); Bundle ownedItems = mService.getPurchases(3, getActivity().getPackageName(), INAPPITEM_TYPE_INAPP, null); if (ownedItems.getInt(RESPONSE_CODE) != BILLING_RESPONSE_RESULT_OK) return; final ArrayList<String> ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); Bundle skuDetails = mService.getSkuDetails(3, getActivity().getPackageName(), INAPPITEM_TYPE_INAPP, querySkus); if (skuDetails.getInt(RESPONSE_CODE) != BILLING_RESPONSE_RESULT_OK) return; final ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST"); if (getActivity() != null) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { createPlayBuyOptions(ownedSkus, responseList); } }); } } catch (RemoteException e) { VpnStatus.logException(e); } }
From source file:net.olejon.spotcommander.DonateActivity.java
private void resetDonations() { try {/*from ww w . jav a 2 s .c o m*/ final Bundle purchasesBundle = mIInAppBillingService.getPurchases(3, getPackageName(), "inapp", null); final int responseCode = purchasesBundle.getInt("RESPONSE_CODE"); if (responseCode == 0) { final ArrayList<String> purchaseDataList = purchasesBundle .getStringArrayList("INAPP_PURCHASE_DATA_LIST"); if (purchaseDataList != null) { for (String purchaseData : purchaseDataList) { consumeDonation(new JSONObject(purchaseData).getString("purchaseToken")); } } mTools.showToast(getString(R.string.donate_reset_success), 0); } else { mTools.showToast(getString(R.string.donate_something_went_wrong), 1); } } catch (Exception e) { mTools.showToast(getString(R.string.donate_something_went_wrong), 1); Log.e("DonateActivity", Log.getStackTraceString(e)); } }
From source file:com.zd.vpn.fragments.AboutFragment.java
private void triggerBuy(String sku) { try {//w w w .j a va 2s .com Bundle buyBundle = mService.getBuyIntent(3, getActivity().getPackageName(), sku, INAPPITEM_TYPE_INAPP, "Thanks for the donation! :)"); if (buyBundle.getInt(RESPONSE_CODE) == BILLING_RESPONSE_RESULT_OK) { PendingIntent buyIntent = buyBundle.getParcelable(RESPONSE_BUY_INTENT); getActivity().startIntentSenderForResult(buyIntent.getIntentSender(), DONATION_CODE, new Intent(), 0, 0, 0); } } catch (RemoteException e) { VpnStatus.logException(e); } catch (IntentSender.SendIntentException e) { VpnStatus.logException(e); } }
From source file:com.chess.genesis.dialog.GameStatsDialog.java
public GameStatsDialog(final Context context, final Bundle bundle) { super(context, BaseDialog.CANCEL); final int from, to; final int status = Integer.parseInt(bundle.getString("status")); final int eventtype = Integer.parseInt(bundle.getString("eventtype")); final int ycol = bundle.getInt("yourcolor"); final String[] statusArr = STATUS_MAP.get(status * ycol); String gametype = Enums.GameType(Integer.parseInt(bundle.getString("gametype"))); gametype = gametype.substring(0, 1).toUpperCase(Locale.US) + gametype.substring(1); if (ycol == Piece.WHITE) { opponent = bundle.getString("black"); from = Integer.parseInt(bundle.getString("w_psrfrom")); to = Integer.parseInt(bundle.getString("w_psrto")); } else {//from w w w . ja v a 2 s . co m opponent = bundle.getString("white"); from = Integer.parseInt(bundle.getString("b_psrfrom")); to = Integer.parseInt(bundle.getString("b_psrto")); } diff = to - from; final String sign = (diff >= 0) ? "+" : "-"; title = statusArr[0]; result = statusArr[1]; psr_type = gametype + " PSR :"; if (eventtype == Enums.INVITE) psr_score = "None (Invite Game)"; else psr_score = sign + String.valueOf(Math.abs(diff)) + " (" + String.valueOf(to) + ')'; }
From source file:com.gamethrive.TrackGooglePurchase.java
private void QueryBoughtItems() { if (isWaitingForPurchasesRequest) return;/*from ww w. j a v a2 s. c o m*/ new Thread(new Runnable() { public void run() { isWaitingForPurchasesRequest = true; try { if (getPurchasesMethod == null) getPurchasesMethod = IInAppBillingServiceClass.getMethod("getPurchases", int.class, String.class, String.class, String.class); Bundle ownedItems = (Bundle) getPurchasesMethod.invoke(mIInAppBillingService, 3, appContext.getPackageName(), "inapp", null); if (ownedItems.getInt("RESPONSE_CODE") == 0) { ArrayList<String> skusToAdd = new ArrayList<String>(); ArrayList<String> newPurchaseTokens = new ArrayList<String>(); ArrayList<String> ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); ArrayList<String> purchaseDataList = ownedItems .getStringArrayList("INAPP_PURCHASE_DATA_LIST"); for (int i = 0; i < purchaseDataList.size(); i++) { String purchaseData = purchaseDataList.get(i); String sku = ownedSkus.get(i); JSONObject itemPurchased = new JSONObject(purchaseData); String purchaseToken = itemPurchased.getString("purchaseToken"); if (!purchaseTokens.contains(purchaseToken) && !newPurchaseTokens.contains(purchaseToken)) { newPurchaseTokens.add(purchaseToken); skusToAdd.add(sku); } } if (skusToAdd.size() > 0) sendPurchases(skusToAdd, newPurchaseTokens); else if (purchaseDataList.size() == 0) { newAsExisting = false; prefsEditor.putBoolean("ExistingPurchases", false); prefsEditor.commit(); } // TODO: Handle very large list. Test for continuationToken != null then call getPurchases again } } catch (Throwable e) { e.printStackTrace(); } isWaitingForPurchasesRequest = false; } }).start(); }