List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:mobisocial.musubi.ui.fragments.FeedViewFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mListView != null) { outState.putInt(EXTRA_NUM_ITEMS, mTotal); }//from w ww . jav a2s. co m }
From source file:de.sourcestream.movieDB.controller.TVList.java
/** * Called to ask the fragment to save its current dynamic state, * so it can later be reconstructed in a new instance of its process is restarted. * * @param outState Bundle in which to place your saved state. *//*from w ww. j a v a2s. c om*/ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Used to avoid bug where we add item in the back stack // and if we change orientation twice the item from the back stack has null values if (save != null) outState.putBundle("save", save); else { Bundle send = new Bundle(); send.putInt("checkLoadMore", checkLoadMore); send.putInt("totalPages", totalPages); send.putString("currentListURL", getCurrentList()); send.putString("title", getTitle()); send.putBoolean("isLoading", isLoading); send.putInt("lastVisitedTV", lastVisitedTV); if (backState == 1) { send.putInt("backState", 1); send.putParcelableArrayList("listData", tvList); // used to restore the scroll listener variables send.putInt("currentPage", endlessScrollListener.getCurrentPage()); send.putInt("oldCount", endlessScrollListener.getOldCount()); send.putBoolean("loading", endlessScrollListener.getLoading()); // Save scroll position if (listView != null) { Parcelable listState = listView.onSaveInstanceState(); send.putParcelable("listViewScroll", listState); } } else send.putInt("backState", 0); outState.putBundle("save", send); } }
From source file:de.sourcestream.movieDB.controller.TVList.java
/** * Callback method to be invoked when an item in this AdapterView has been clicked. * * @param parent The AdapterView where the click happened. * @param view The view within the AdapterView that was clicked (this will be a view provided by the adapter) * @param position The position of the view in the adapter. * @param id The row id of the item that was clicked. *///from www . j a v a 2 s . c om @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { activity.resetMovieDetailsBundle(); activity.setRestoreMovieDetailsAdapterState(true); activity.setRestoreMovieDetailsState(false); activity.setOrientationChanged(false); activity.resetCastDetailsBundle(); activity.resetTvDetailsBundle(); if (tvDetails != null && lastVisitedTV == tvList.get(position).getId() && tvDetails.getTimeOut() == 0) { // Old movie details retrieve info and re-init component else crash tvDetails.onSaveInstanceState(new Bundle()); Bundle bundle = new Bundle(); bundle.putInt("id", tvList.get(position).getId()); Bundle save = tvDetails.getSave(); tvDetails = new TVDetails(); tvDetails.setTimeOut(0); tvDetails.setSave(save); tvDetails.setArguments(bundle); } else tvDetails = new TVDetails(); lastVisitedTV = tvList.get(position).getId(); tvDetails.setTitle(tvList.get(position).getTitle()); FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); Bundle bundle = new Bundle(); bundle.putInt("id", tvList.get(position).getId()); tvDetails.setArguments(bundle); transaction.replace(R.id.frame_container, tvDetails); // add the current transaction to the back stack: transaction.addToBackStack("TVList"); transaction.commit(); fragmentActive = true; activity.getTvSlideTab().showInstantToolbar(); }
From source file:com.skubit.android.billing.BillingServiceBinder.java
@Override public Bundle getPurchases(int apiVersion, String userId, String packageName, String type, String continuationToken) throws RemoteException { Bundle bundle = new Bundle(); if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(type)) { Log.d(TAG, "Missing required parameter"); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_DEVELOPER_ERROR); return bundle; }/*ww w . j av a2s .c o m*/ if (apiVersion != 1) { Log.d(TAG, "Unsupported API: " + apiVersion); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE); return bundle; } if (!isValidType(type)) { Log.d(TAG, "Incorrect billing type: " + type); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE); return bundle; } int packValidate = validatePackageIsOwnedByCaller(packageName); if (packValidate != BillingResponseCodes.RESULT_OK) { Log.d(TAG, "Package is not owned by caller"); bundle.putInt("RESPONSE_CODE", packValidate); return bundle; } String account = userId; if (hasAccess(account, packageName)) { Log.d(TAG, "User account not configured"); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_USER_ACCESS); return bundle; } Utils.changeAccount(mContext, userId); PurchaseRestService service = new PurchaseService(account, mContext).getRestService(); ArrayList<String> ids = new ArrayList<>(); ArrayList<String> data = new ArrayList<>(); ArrayList<String> sigs = new ArrayList<>(); InAppPurchaseDataListDto list = null; try { list = service.getPurchaseDatas(packageName, 500, 0, continuationToken, true, 0); } catch (Exception e) { e.printStackTrace(); } if (list != null) { for (InAppPurchaseDataDto dto : list.getItems()) { ids.add(dto.getId()); data.add(dto.getMessage()); sigs.add(dto.getSignature()); } bundle.putString("INAPP_CONTINUATION_TOKEN", list.getNextLink()); } bundle.putStringArrayList("INAPP_PURCHASE_ITEM_LIST", ids); bundle.putStringArrayList("INAPP_PURCHASE_DATA_LIST", data); bundle.putStringArrayList("INAPP_DATA_SIGNATURE_LIST", sigs); return bundle; }
From source file:com.bonsai.wallet32.SweepKeyActivity.java
public void sweepKey(View view) { if (mWalletService == null) { showErrorDialog(mRes.getString(R.string.sweep_error_nowallet)); return;/*from w w w . jav a 2s. c o m*/ } // Fetch the private key. if (mKey == null) { showErrorDialog(mRes.getString(R.string.sweep_error_nokey)); return; } // Make sure we have fetched the unspent outputs. if (mUnspentOutputs == null) { showErrorDialog(mRes.getString(R.string.sweep_error_nooutputs)); return; } // Fetch the fee amount. long fee = 0; EditText feeEditText = (EditText) findViewById(R.id.fee_btc); String feeString = feeEditText.getText().toString(); if (feeString.length() == 0) { showErrorDialog(mRes.getString(R.string.sweep_error_nofee)); return; } try { fee = mBTCFmt.parse(feeString); } catch (NumberFormatException ex) { showErrorDialog(mRes.getString(R.string.sweep_error_badfee)); return; } // Which account was selected? if (mAccountId == -1) { showErrorDialog(mRes.getString(R.string.sweep_error_noaccount)); return; } // Sweep! mWalletService.sweepKey(mKey, fee, mAccountId, mUnspentOutputs); // Head to the transaction view for this account ... Intent intent = new Intent(this, ViewTransactionsActivity.class); Bundle bundle = new Bundle(); bundle.putInt("accountId", mAccountId); intent.putExtras(bundle); startActivity(intent); // We're done here ... finish(); }
From source file:es.uniovi.imovil.fcrtrainer.BaseExerciseFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_IS_PLAYING, mIsPlaying); outState.putLong(STATE_CONSUMED_TIME_MS, mDurationMs - getRemainingTimeMs()); outState.putLong(STATE_DURATION_TIME_MS, mDurationMs); outState.putInt(STATE_SCORE, mScore); }
From source file:net.reichholf.dreamdroid.fragment.MediaPlayerFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putInt(STATE_MEDIA_INDEX, mMediaIndex); super.onSaveInstanceState(outState); }
From source file:mp.paschalis.LoginFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Save the current library selection in case we need to recreate the // fragment/* ww w. j ava 2 s.co m*/ outState.putInt(ARG_POSITION, mCurrentPosition); }
From source file:com.openerp.addons.messages.MessageDetail.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case MESSAGE_REPLY: if (resultCode == Activity.RESULT_OK) { Bundle bundle = new Bundle(); bundle.putInt("message_id", message_id); LoadMessageDetails messageDetails = new LoadMessageDetails(message_id); messageDetails.execute((Void) null); }//from www . j a v a 2 s .co m break; } }
From source file:com.lepin.activity.MyOrderDetailActivity.java
@Override public void onClick(View view) { if (this.btnBack == view) {// finish();//from www . j a va 2 s.c o m } else if (this.mCancleDriverBtn == view) {// ?? operateType = DRIVER_CANCLE_ORDER; doBtnPress(); } else if (this.mPhoneButton == view) { contactEachOther(); } else if (view == this.mTwoPayOrInBtn) { // if (mBookState.equals(Book.STATE_NEW)) { operateType = PAY; } else if (mBookState.equals(Book.STATE_PAYMENT)) { operateType = COMFIRM_IN; } doBtnPress(); } else if (view == this.mTwoCancelBtn) { operateType = CANCEL_ORDER; isCancelOrder = isCanCancleOrder(mBookState.equals(Book.STATE_PAYMENT)); // ?? // ?????? doBtnPress(); } else if (view == this.btnShare) { util.share(MyOrderDetailActivity.this, book_id, mController, UMSharingMyOrder.SHARE_TYPE_ORDER, Constant.URL_SHARE_ORDER, getString(R.string.share_order_content), getString(R.string.share_order_title)); } else if (view == mapImageView) { Util.getInstance().showStartAndEndOnMap(this, mPinche); } else if (view == mPhotoView) {// ? User user = null; String role = ""; if (book.getDriver() != null) { user = book.getDriver(); role = Constant.DRIVER; } else if (book.getPassenger() != null) { user = book.getPassenger(); role = Constant.PASSENGER; } if (user == null) return; Bundle dataBundle = new Bundle(); dataBundle.putInt("userId", user.getUserId()); dataBundle.putString("role", role); util.go2ActivityWithBundle(MyOrderDetailActivity.this, PersonalInfoTrailActivity.class, dataBundle); } }