List of usage examples for android.os Bundle getParcelable
@Nullable public <T extends Parcelable> T getParcelable(@Nullable String key)
From source file:at.bitfire.davdroid.ui.setup.DetectConfigurationFragment.java
@Override public Loader<Configuration> onCreateLoader(int id, Bundle args) { return new ServerConfigurationLoader(getContext(), (LoginCredentials) args.getParcelable(ARG_LOGIN_CREDENTIALS)); }
From source file:co.paulburke.android.textviewpager.TextViewPager.java
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; state = bundle.getParcelable(INSTANCE_STATE); mRestoredOffset = bundle.getInt(STATE_OFFSET); }// w w w . j ava2 s. co m super.onRestoreInstanceState(state); }
From source file:com.bdenney.locl.activity.VenuePostsActivity.java
private Venue getVenue() { final Intent intent = getIntent(); Bundle extras = null; Venue venue = null;//from w ww . j a va 2 s .co m if (intent != null) { extras = intent.getExtras(); } if (extras != null) { venue = extras.getParcelable(EXTRA_VENUE); } return venue; }
From source file:at.jclehner.rxdroid.DrugSupplyEditFragment.java
@Override public Dialog onCreateDialog(Bundle icicle) { final Drug drug = getDrug(); final Fraction value; if (icicle != null) value = icicle.getParcelable("value"); else//w w w . j a va2 s.c o m value = drug.getCurrentSupply(); final Dialog d = new Dialog(getActivity(), value, drug.getRefillSize(), mListener); d.setTitle(getString(R.string._title_supply_edit, drug.getName())); return d; }
From source file:ch.berta.fabio.popularmovies.presentation.ui.fragments.MovieDetailsFavFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { mViewModel = args.getParcelable(KEY_VIEW_MODEL); }//from w w w. j ava 2 s. c o m }
From source file:com.codebutler.farebot.activities.ReadingTagActivity.java
private void resolveIntent(Intent intent) { final TextView textView = (TextView) findViewById(R.id.textView); try {//from ww w . j av a2 s .c o m Bundle extras = intent.getExtras(); final Tag tag = (Tag) extras.getParcelable("android.nfc.extra.TAG"); ; final String[] techs = tag.getTechList(); new AsyncTask<Void, String, MifareCard>() { Exception mException; @Override protected MifareCard doInBackground(Void... params) { try { if (ArrayUtils.contains(techs, "android.nfc.tech.NfcB")) return CEPASCard.dumpTag(tag.getId(), tag); else if (ArrayUtils.contains(techs, "android.nfc.tech.IsoDep")) return DesfireCard.dumpTag(tag.getId(), tag); else throw new UnsupportedTagException(techs, Utils.getHexString(tag.getId())); } catch (Exception ex) { mException = ex; return null; } } @Override protected void onPostExecute(MifareCard card) { if (mException != null) { if (mException instanceof UnsupportedTagException) { UnsupportedTagException ex = (UnsupportedTagException) mException; new AlertDialog.Builder(ReadingTagActivity.this).setTitle("Unsupported Tag") .setMessage(ex.getMessage()).setCancelable(false) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { finish(); } }).show(); } else { Utils.showErrorAndFinish(ReadingTagActivity.this, mException); } return; } try { String cardXml = Utils.xmlNodeToString(card.toXML().getOwnerDocument()); ContentValues values = new ContentValues(); values.put(CardsTableColumns.TYPE, card.getCardType().toInteger()); values.put(CardsTableColumns.TAG_SERIAL, Utils.getHexString(card.getTagId())); values.put(CardsTableColumns.DATA, cardXml); values.put(CardsTableColumns.SCANNED_AT, card.getScannedAt().getTime()); Uri uri = getContentResolver().insert(CardProvider.CONTENT_URI_CARD, values); startActivity(new Intent(Intent.ACTION_VIEW, uri)); finish(); } catch (Exception ex) { Utils.showErrorAndFinish(ReadingTagActivity.this, ex); } } @Override protected void onProgressUpdate(String... values) { textView.setText(values[0]); } }.execute(); } catch (Exception ex) { Utils.showErrorAndFinish(this, ex); } }
From source file:ch.berta.fabio.popularmovies.presentation.ui.fragments.MovieGridFavFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { mViewModel = args.getParcelable(KEY_VIEW_MODEL); }/*from ww w .ja va2 s .c o m*/ mMovieRepo = new MovieRepositoryImpl(); }
From source file:fr.cph.stock.android.activity.OverallActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.overall_activity); errorView = (TextView) findViewById(R.id.errorMessage); Bundle b = getIntent().getExtras(); portfolio = b.getParcelable("portfolio"); shareValues = portfolio.getShareValues(); ada = new ShareValueAdapter(shareValues, getApplicationContext()); setListAdapter(ada);//from w w w . ja v a 2 s .co m // Set context EasyTracker.getInstance().setContext(getApplicationContext()); // Instantiate the Tracker tracker = EasyTracker.getTracker(); }
From source file:com.moto.miletus.application.tabs.CommandsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_commands); if (!(Thread.getDefaultUncaughtExceptionHandler() instanceof CustomExceptionHandler)) { Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(this)); }/*from w w w. j av a 2 s . c om*/ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED); final Bundle state = savedInstanceState != null ? savedInstanceState : getIntent().getExtras(); mComponent = state.getParcelable(Strings.EXTRA_KEY_DEVICE_COMPONENT); mDevice = state.getParcelable(Strings.EXTRA_KEY_DEVICE); if (mDevice == null || mComponent == null) { throw new IllegalArgumentException("Error in intent extra"); } final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setTitle(StringUtils.capitalize( mDevice.getDevice().getName().replace(com.moto.miletus.utils.Strings.mSearchName, ""))); actionBar.setSubtitle(StringUtils.capitalize(getComponent().getTraitName().replace("_", ""))); } }
From source file:fr.cph.stock.android.activity.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); switch (resultCode) { case 100:/*from w w w . j a va2 s. co m*/ finish(); break; case Activity.RESULT_OK: Bundle b = data.getExtras(); portfolio = b.getParcelable("portfolio"); ada.update(portfolio); break; } }