List of usage examples for android.os Bundle putSerializable
@Override public void putSerializable(@Nullable String key, @Nullable Serializable value)
From source file:com.adamas.client.android.MainActivity.java
private void processQrCodeText(String content) { if (content != null && content.trim().length() == 32) { //Connector key content = content.trim();/*from w w w.ja v a 2 s. c om*/ SharedPreferences sharedPref = getSharedPreferences(Store.STORE_ADAMAS_CONNECTORS, Context.MODE_PRIVATE); Store.saveConnectorKey(sharedPref, Converter.hexToBytes(content)); toast(getString(R.string.toast_connector_key_saved), ToastType.info); } else if (content != null && content.trim().length() > 0) { Connector connector = Connector.parseStringFromQrCode(content); if (connector == null) { //maybe it is encrypted, let's decrypt it SharedPreferences sharedPref = getSharedPreferences(Store.STORE_ADAMAS_CONNECTORS, Context.MODE_PRIVATE); List<byte[]> keys = Store.loadConnectorKeys(sharedPref); byte[] bytes = Converter.hexToBytes(content.trim()); for (byte[] key : keys) { byte[] decrypted = CryptUtil.decrypt(key, bytes); if (decrypted != null) { connector = Connector.parseStringFromQrCode(new String(decrypted)); if (connector != null) { break; } } } } if (connector != null) { Intent importIntent = new Intent(this, ImportConnectorActivity.class); Bundle mBundle = new Bundle(); mBundle.putSerializable(ImportConnectorActivity.ADAMAS_CONNECTOR, connector); importIntent.putExtras(mBundle); startActivityForResult(importIntent, IMPORT_CONNECTOR_REQUEST_CODE); } } }
From source file:com.cerema.cloud2.ui.activity.Uploader.java
@Override protected void onSaveInstanceState(Bundle outState) { Log_OC.d(TAG, "onSaveInstanceState() start"); super.onSaveInstanceState(outState); outState.putSerializable(KEY_PARENTS, mParents); //outState.putParcelable(KEY_ACCOUNT, mAccount); outState.putParcelable(KEY_FILE, mFile); outState.putBoolean(KEY_ACCOUNT_SELECTED, mAccountSelected); outState.putBoolean(KEY_ACCOUNT_SELECTION_SHOWING, mAccountSelectionShowing); outState.putInt(KEY_NUM_CACHE_FILE, mNumCacheFile); outState.putStringArrayList(KEY_REMOTE_CACHE_DATA, mRemoteCacheData); outState.putParcelable(FileActivity.EXTRA_ACCOUNT, getAccount()); Log_OC.d(TAG, "onSaveInstanceState() end"); }
From source file:com.ibuildapp.romanblack.NewsPlugin.NewsPlugin.java
public void startRssDetails(int adapterPosition) { FeedItem currentItem = items.get(adapterPosition); if ((currentItem.getMediaType() != null && currentItem.getMediaType().contains("image")) || !currentItem.hasMedia() || currentItem.getDescription().length() > 70) { Intent details = new Intent(this, NewsDetailsActivity.class); Bundle store = new Bundle(); store.putString("func", funcName); store.putSerializable("Widget", widget); store.putSerializable("item", items.get(adapterPosition)); if (encoding.equals("")) { store.putString("enc", "UTF-8"); } else {/* w ww. j a va 2 s . c o m*/ store.putString("enc", encoding); } details.putExtras(store); startActivity(details); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } else if (currentItem.getMediaType().contains("video")) { Intent details = new Intent(this, VideoPlayer.class); Bundle store = new Bundle(); store.putString("link", currentItem.getMediaUrl()); store.putString("cache", cachePath); store.putSerializable("Widget", widget); store.putSerializable("item", currentItem); details.putExtras(store); startActivity(details); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } else if (currentItem.getMediaType().contains("audio")) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(currentItem.getMediaUrl()), "audio/*"); startActivity(intent); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } }
From source file:ch.teamuit.android.soundplusplus.LibraryPagerAdapter.java
@Override public Parcelable saveState() { Bundle out = new Bundle(10); if (mArtistAdapter != null) out.putSerializable("limiter_artists", mArtistAdapter.getLimiter()); if (mAlbumAdapter != null) out.putSerializable("limiter_albums", mAlbumAdapter.getLimiter()); if (mSongAdapter != null) out.putSerializable("limiter_songs", mSongAdapter.getLimiter()); if (mFilesAdapter != null) out.putSerializable("limiter_files", mFilesAdapter.getLimiter()); maintainPosition();//from ww w. j a va 2 s. c o m return out; }
From source file:com.android.deskclock.timer.TimerFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // If the timer creation view is visible, store the input for later restoration. if (mCurrentView == mCreateTimerView) { mTimerSetupState = mCreateTimerView.getState(); outState.putSerializable(KEY_TIMER_SETUP_STATE, mTimerSetupState); }/*from w w w.jav a 2 s. c om*/ }
From source file:com.androidquery.simplefeed.activity.PostActivity.java
@Override public void onSaveInstanceState(Bundle bundle) { bundle.putSerializable("photo", photo); bundle.putString("message", getMessage()); bundle.putParcelable("location", location); bundle.putSerializable("place", place); bundle.putSerializable("tags", (Serializable) tags); }
From source file:com.hackensack.umc.activity.ProfileSelfiewithCropActivity.java
private void startRegistrationActivity(DataForAutoRegistration dataTosend) { Intent intent = new Intent(ProfileSelfiewithCropActivity.this, RegistrationDetailsActivity.class); Bundle b = new Bundle(); b.putSerializable(Constant.REG_REQUIRED_DATA, dataTosend); b.putInt(Constant.REGISTRATION_MODE, Constant.AUTO); b = putUrlValuesInBundle(b);//w w w.j a v a2 s. co m intent.putExtra(Constant.BUNDLE, b); startActivity(intent); }
From source file:com.adamas.client.android.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } else if (id == R.id.action_scan_qr_code) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { IntentIntegrator integrator = new IntentIntegrator(this); integrator.initiateScan();/*from www . j av a 2 s.co m*/ } else { checkCameraPermission(); } } else if (id == R.id.action_delete_connector) { if (_connectorfragment != null) { _connectorfragment.deleteConnector(_selectedAdamasConnector); } } else if (id == R.id.action_add_connector_manually) { Intent intent = new Intent(this, AddConnectorActivity.class); startActivityForResult(intent, MANUALLY_ADD_CONNECTOR_REQUEST_CODE); } else if (id == R.id.action_edit_connector) { Intent intent = new Intent(this, EditConnectorActivity.class); Bundle mBundle = new Bundle(); mBundle.putSerializable(EditConnectorActivity.ADAMAS_CONNECTOR, _selectedAdamasConnector); intent.putExtras(mBundle); startActivityForResult(intent, MANUALLY_EDIT_CONNECTOR_REQUEST_CODE); } else if (id == R.id.action_import_connector_from_text) { Intent intent = new Intent(this, ImportTextActivity.class); startActivityForResult(intent, IMPORT_FROM_TEXT_REQUEST_CODE); } else if (id == R.id.action_import_connector_from_image) { if (false) { FileChooser fileChooser = new FileChooser(this); fileChooser.setFileListener(new FileChooser.FileSelectedListener() { @Override public void fileSelected(final File file) { String name = file.getAbsolutePath(); name = name; } }); fileChooser.showDialog(); } else { // this is much better Intent intent = new Intent(Intent.ACTION_GET_CONTENT); Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath()); intent.setDataAndType(uri, "image/jpeg"); startActivityForResult(Intent.createChooser(intent, getString(R.string.open)), IMPORT_FROM_FILE_REQUEST_CODE); } } return super.onOptionsItemSelected(item); }
From source file:com.ibuildapp.romanblack.NewsPlugin.NewsPlugin.java
private void showDetails(int position) { try {//from ww w. j av a 2 s . c o m if ((items.get(position).getMediaType() != null && items.get(position).getMediaType().contains("image")) || !items.get(position).hasMedia() || items.get(position).getDescription().length() > 70) { Intent details = new Intent(this, FeedDetails.class); Bundle store = new Bundle(); store.putString("func", funcName); store.putSerializable("Widget", widget); store.putSerializable("item", items.get(position)); if (encoding.equals("")) { store.putString("enc", "UTF-8"); } else { store.putString("enc", encoding); } details.putExtras(store); startActivity(details); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } else { if (items.get(position).getMediaType().contains("video")) { Intent details = new Intent(this, VideoPlayer.class); Bundle store = new Bundle(); store.putString("link", items.get(position).getMediaUrl()); store.putString("cache", cachePath); store.putSerializable("Widget", widget); store.putSerializable("item", items.get(position)); details.putExtras(store); startActivity(details); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } else if (items.get(position).getMediaType().contains("audio")) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(items.get(position).getMediaUrl()), "audio/*"); startActivity(intent); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } } } catch (Exception ex) { // Error Logging ex.printStackTrace(); } }
From source file:com.hackensack.umc.activity.ProfileSelfieActivity.java
private void startRegistrationActivity(DataForAutoRegistration dataTosend) { Intent intent = new Intent(ProfileSelfieActivity.this, RegistrationDetailsActivity.class); Bundle b = new Bundle(); b.putSerializable(Constant.REG_REQUIRED_DATA, dataTosend); b.putInt(Constant.REGISTRATION_MODE, Constant.AUTO); b = putUrlValuesInBundle(b);/*from w w w . j a v a 2 s . com*/ intent.putExtra(Constant.BUNDLE, b); startActivity(intent); }