List of usage examples for android.os Bundle getParcelable
@Nullable public <T extends Parcelable> T getParcelable(@Nullable String key)
From source file:com.ayuget.redface.ui.activity.TopicsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_topics, savedInstanceState); if (getIntent().getData() != null) { restoredInstanceState = true;//from w ww . j av a2s. c om String url = getIntent().getData().toString(); urlParser.parseUrl(url).ifTopicLink(new MDLink.IfIsTopicLink() { @Override public void call(final Category category, final int topicId, final int topicPage, final PagePosition pagePosition) { Log.d(LOG_TAG, String.format("Parsed link for category='%s', topic='%d', page='%d'", category.getName(), topicId, topicPage)); onGoToTopicEvent(new GoToTopicEvent(category, topicId, topicPage, pagePosition)); } }); } else if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if (extras != null) { Category savedCategory = extras.getParcelable(UIConstants.ARG_SELECTED_CATEGORY); if (savedCategory != null) { if (savedCategory.getId() == categoriesStore.getMetaCategory().getId()) { onMyTopicsClicked(); } else { onCategoryClicked(savedCategory); } } } } }
From source file:edu.stanford.junction.sample.partyware.ImgurUploadService.java
/** * /* ww w.j a v a2 s.c o m*/ * @return a map that contains objects with the following keys: * * delete - the url used to delete the uploaded image (null if * error). * * original - the url to the uploaded image (null if error) The map * is null if error */ private Map<String, String> handleSendIntent(final Intent intent) { Log.i(this.getClass().getName(), "in handleResponse()"); Log.d(this.getClass().getName(), intent.toString()); final Bundle extras = intent.getExtras(); try { //upload a new image if (Intent.ACTION_SEND.equals(intent.getAction()) && (extras != null) && extras.containsKey(Intent.EXTRA_STREAM)) { final Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM); if (uri != null) { Log.d(this.getClass().getName(), uri.toString()); imageLocation = uri; final String jsonOutput = readPictureDataAndUpload(uri); return parseJSONResponse(jsonOutput); } Log.e(this.getClass().getName(), "URI null"); } } catch (final Exception e) { Log.e(this.getClass().getName(), "Completely unexpected error", e); } return null; }
From source file:com.bitants.wally.fragments.ImageZoomFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true);/* w w w .j av a 2 s . c o m*/ if (savedInstanceState != null) { if (savedInstanceState.containsKey(STATE_BITMAP)) { bitmap = savedInstanceState.getParcelable(STATE_BITMAP); } if (savedInstanceState.containsKey(STATE_TOOLBAR_VISIBILITY)) { toolBarVisibility = savedInstanceState.getInt(STATE_TOOLBAR_VISIBILITY, View.GONE); } if (savedInstanceState.containsKey(STATE_URI_FILE)) { fileUri = savedInstanceState.getParcelable(STATE_URI_FILE); } if (savedInstanceState.containsKey(STATE_URI_CONTENT)) { contentUri = savedInstanceState.getParcelable(STATE_URI_CONTENT); } } }
From source file:com.crossconnect.activity.main.ResourceFragment.java
@Override public Loader<List<OnlineAudioResource>> onCreateLoader(int id, Bundle args) { // This is called when a new Loader needs to be created. Log.i(TAG, "onCreateLoader()"); //Start with progress indicator resourceListLoader = new ResourceLoader(getActivity(), (BibleText) args.getParcelable("BibleText")); return resourceListLoader; }
From source file:com.android.server.telecom.testapps.TestConnectionService.java
@Override public Connection onCreateUnknownConnection(PhoneAccountHandle connectionManagerPhoneAccount, final ConnectionRequest request) { PhoneAccountHandle accountHandle = request.getAccountHandle(); ComponentName componentName = new ComponentName(this, TestConnectionService.class); if (accountHandle != null && componentName.equals(accountHandle.getComponentName())) { final TestConnection connection = new TestConnection(false); final Bundle extras = request.getExtras(); final Uri providedHandle = extras.getParcelable(EXTRA_HANDLE); Uri handle = providedHandle == null ? Uri.fromParts(PhoneAccount.SCHEME_TEL, getDummyNumber(false), null) : providedHandle;/*from ww w. j av a 2 s . c om*/ connection.setAddress(handle, TelecomManager.PRESENTATION_ALLOWED); connection.setDialing(); addCall(connection); return connection; } else { return Connection.createFailedConnection(new DisconnectCause(DisconnectCause.ERROR, "Invalid inputs: " + accountHandle + " " + componentName)); } }
From source file:com.maass.android.imgur_uploader.ImgurUpload.java
/** * // w ww . j ava 2 s.co m * @return a map that contains objects with the following keys: * * delete - the url used to delete the uploaded image (null if * error). * * original - the url to the uploaded image (null if error) The map * is null if error */ private Map<String, String> handleSendIntent(final Intent intent) { Log.i(this.getClass().getName(), "in handleResponse()"); Log.d(this.getClass().getName(), intent.toString()); final Bundle extras = intent.getExtras(); try { //upload a new image if (Intent.ACTION_SEND.equals(intent.getAction()) && (extras != null) && extras.containsKey(Intent.EXTRA_STREAM)) { final Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM); if (uri != null) { Log.d(this.getClass().getName(), uri.toString()); // store uri so we can create the thumbnail if we succeed imageLocation = uri; final String jsonOutput = readPictureDataAndUpload(uri); return parseJSONResponse(jsonOutput); } Log.e(this.getClass().getName(), "URI null"); } } catch (final Exception e) { Log.e(this.getClass().getName(), "Completely unexpected error", e); } return null; }
From source file:at.tomtasche.reader.ui.activity.DocumentActivity.java
@Override public Loader<Document> onCreateLoader(int id, Bundle bundle) { boolean limit = true; boolean translatable = false; String password = null;//from w w w . j av a 2 s .c om Uri uri = DocumentLoader.URI_INTRO; if (bundle != null) { uri = bundle.getParcelable(EXTRA_URI); limit = bundle.getBoolean(EXTRA_LIMIT); translatable = bundle.getBoolean(EXTRA_TRANSLATABLE); password = bundle.getString(EXTRA_PASSWORD); } switch (id) { case 0: DocumentLoader documentLoader = new DocumentLoader(this, uri); documentLoader.setPassword(password); documentLoader.setLimit(limit); documentLoader.setTranslatable(translatable); showProgress(documentLoader, false); return documentLoader; case 1: default: UpLoader upLoader = new UpLoader(this, uri); showProgress(upLoader, true); return upLoader; } }
From source file:com.android.managedprovisioning.ProfileOwnerProvisioningActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ProvisionLogger.logd("Profile owner provisioning activity ONCREATE"); mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE); if (savedInstanceState != null) { mCancelStatus = savedInstanceState.getInt(KEY_STATUS, STATUS_PROVISIONING); mPendingProvisioningResult = savedInstanceState.getParcelable(KEY_PENDING_INTENT); }/*from ww w .ja va 2 s . com*/ initializeLayoutParams(R.layout.progress, R.string.setup_work_profile, true); configureNavigationButtons(NEXT_BUTTON_EMPTY_LABEL, View.INVISIBLE, View.VISIBLE); setTitle(R.string.setup_profile_progress); TextView textView = (TextView) findViewById(R.id.prog_text); if (textView != null) textView.setText(R.string.setting_up_workspace); if (mCancelStatus == STATUS_CANCEL_CONFIRMING) { showCancelProvisioningDialog(); } else if (mCancelStatus == STATUS_CANCELLING) { showCancelProgressDialog(); } mParams = (ProvisioningParams) getIntent().getParcelableExtra(ProvisioningParams.EXTRA_PROVISIONING_PARAMS); if (mParams != null) { maybeSetLogoAndMainColor(mParams.mainColor); } }
From source file:com.appsimobile.appsii.iab.IabPurchaseHelper.java
/** * Initiate the UI flow for an in-app purchase. Call this method to initiate an in-app purchase, * which will involve bringing up the Google Play screen. The calling activity will be paused * while/*from w w w . j av a 2 s .c o m*/ * the user interacts with Google Play, and the result will be delivered via the activity's * {@link android.app.Activity#onActivityResult} method, at which point you must call * this object's {@link #handleActivityResult} method to continue the purchase flow. This method * MUST be called from the UI thread of the Activity. * * @param act The calling activity. * @param sku The sku of the item to purchase. * @param itemType indicates if it's a product or a subscription (ITEM_TYPE_INAPP or * ITEM_TYPE_SUBS) * @param requestCode A request code (to differentiate from other responses -- * as in {@link android.app.Activity#startActivityForResult}). * @param developerPayload Extra data (developer payload), which will be returned with the * purchase data * when the purchase completes. This extra data will be permanently bound to that purchase * and will always be returned when the purchase is queried. */ public int launchPurchaseFlow(Activity act, String sku, String itemType, int requestCode, String developerPayload) { checkSetupDone("launchPurchaseFlow"); if (itemType.equals(ITEM_TYPE_SUBS) && !mSubscriptionsSupported) { return IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE; } try { logDebug("Constructing buy intent for " + sku + ", item type: " + itemType); Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, itemType, developerPayload); int response = getResponseCodeFromBundle(buyIntentBundle); if (response != BILLING_RESPONSE_RESULT_OK) { logError("Unable to buy item, Error response: " + getResponseDesc(response)); return response; } PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT); logDebug("Launching buy intent for " + sku + ". Request code: " + requestCode); act.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, new Intent(), 0, 0, 0); return BILLING_RESPONSE_RESULT_OK; } catch (SendIntentException e) { logError("SendIntentException while launching purchase flow for sku " + sku); e.printStackTrace(); return IABHELPER_SEND_INTENT_FAILED; } catch (RemoteException e) { logError("RemoteException while launching purchase flow for sku " + sku); e.printStackTrace(); return IABHELPER_REMOTE_EXCEPTION; } }
From source file:com.akop.bach.fragment.xboxlive.AchievementsFragment.java
@Override public void onCreate(Bundle state) { super.onCreate(state); if (mAccount == null) { Bundle args = getArguments(); mAccount = (XboxLiveAccount) args.getParcelable("account"); mTitleId = args.getLong("titleId", -1); }/*from w w w . j a v a 2s . c o m*/ if (state != null) { mAccount = (XboxLiveAccount) state.getParcelable("account"); mTitleId = state.getLong("titleId"); } setHasOptionsMenu(true); }