List of usage examples for android.os Bundle getParcelable
@Nullable public <T extends Parcelable> T getParcelable(@Nullable String key)
From source file:ca.frozen.rpicameraviewer.activities.VideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // configure the activity super.onCreate(savedInstanceState); setContentView(R.layout.activity_video); //Log.d(TAG, "onCreate"); // load the settings and cameras Utils.loadData();/* w w w . j av a 2s . c om*/ // get the camera object Bundle data = getIntent().getExtras(); camera = data.getParcelable(CAMERA); // get the frame layout, handle system visibility changes frameLayout = (FrameLayout) findViewById(R.id.video); frameLayout.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { videoFragment.startFadeIn(); } } }); // set full screen layout int visibility = frameLayout.getSystemUiVisibility(); visibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; frameLayout.setSystemUiVisibility(visibility); // create the video fragment videoFragment = videoFragment.newInstance(camera, true); FragmentTransaction fragTran = getSupportFragmentManager().beginTransaction(); fragTran.add(R.id.video, videoFragment); fragTran.commit(); }
From source file:at.bitfire.davdroid.ui.DeleteCollectionFragment.java
@Override public Loader<Exception> onCreateLoader(int id, Bundle args) { account = args.getParcelable(ARG_ACCOUNT); collectionInfo = (CollectionInfo) args.getSerializable(ARG_COLLECTION_INFO); return new DeleteCollectionLoader(getContext(), account, collectionInfo); }
From source file:geert.stef.sm.beheerautokm.HistoryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_history); getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.darkblue))); Bundle b = getIntent().getExtras(); manager = b.getParcelable("parcel"); selectedCar = b.getParcelable("car"); getSupportActionBar().setTitle(selectedCar.getCar()); this.getRitten(); ArrayList<Rit> rittenSelectedCar = new ArrayList<>(); for (Rit r : manager.getRitten()) { if (r.getCar().equals(selectedCar.getLicensePlate())) { rittenSelectedCar.add(r);/*from w w w . ja v a2 s.com*/ } } listView = (ListView) findViewById(R.id.lvRit); ritAdapter = new RitListAdapter(this.getApplicationContext(), rittenSelectedCar); listView.setAdapter(ritAdapter); }
From source file:com.commonsware.cwac.colormixer.ColorMixer.java
@Override public void onRestoreInstanceState(Parcelable ss) { Bundle state = (Bundle) ss; super.onRestoreInstanceState(state.getParcelable(SUPERSTATE)); setColor(state.getInt(COLOR));/* w w w. j av a2 s . c o m*/ }
From source file:fr.cph.stock.android.activity.EquityActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.v(TAG, "EquityActivity onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.equity_list_activity); errorView = (TextView) findViewById(R.id.errorMessage); Bundle b = getIntent().getExtras(); Portfolio portfolio = b.getParcelable("portfolio"); equities = portfolio.getEquities();// w w w. j a v a 2s . c o m mAdapter = new EquityAdapter(equities, getApplicationContext()); setListAdapter(mAdapter); lastUpdatedView = (TextView) findViewById(R.id.lastUpdated); lastUpdatedView.setText(portfolio.getLastUpdate()); // Set context EasyTracker.getInstance().setContext(getApplicationContext()); // Instantiate the Tracker tracker = EasyTracker.getTracker(); }
From source file:cn.hjl.newspush.mvp.ui.activities.NewsPhotoDetailActivity.java
@Override public void initViews() { Bundle args = getArguments(); mNewsPhotoDetail = args.getParcelable(Constants.PHOTO_DETAIL); createFragment(mNewsPhotoDetail);/*from w ww . j ava 2 s . c o m*/ initViewPager(); setPhotoDetailTitle(0); }
From source file:com.codename1.impl.android.LocalNotificationPublisher.java
public void onReceive(Context context, Intent intent) { //Fire the notification to the display NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); Bundle extras = intent.getExtras(); PendingIntent content = extras.getParcelable(NOTIFICATION_INTENT); Bundle b = extras.getParcelable(NOTIFICATION); LocalNotification notif = AndroidImplementation.createNotificationFromBundle(b); if (AndroidImplementation.BACKGROUND_FETCH_NOTIFICATION_ID.equals(notif.getId())) { PendingIntent backgroundFetchIntent = extras.getParcelable(BACKGROUND_FETCH_INTENT); if (backgroundFetchIntent != null) { try { backgroundFetchIntent.send(); } catch (Exception ex) { Log.e("Codename One", "Failed to send BackgroundFetchHandler intent", ex); }// w w w . ja v a 2s.c om } else { Log.d("Codename One", "BackgroundFetch intent was null"); } } else { Notification notification = createAndroidNotification(context, notif, content); notification.when = System.currentTimeMillis(); try { int notifId = Integer.parseInt(notif.getId()); notificationManager.notify("CN1", notifId, notification); } catch (Exception e) { //that was a mistake, the first param is the tag not the id notificationManager.notify(notif.getId(), 0, notification); } } }
From source file:at.bitfire.davdroid.ui.ExceptionInfoFragment.java
@NonNull @Override//from w w w.j a va2 s . com public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle args = getArguments(); final Exception exception = (Exception) args.getSerializable(ARG_EXCEPTION); final Account account = args.getParcelable(ARG_ACCOUNT); int title = R.string.exception; if (exception instanceof HttpException) title = R.string.exception_httpexception; else if (exception instanceof IOException) title = R.string.exception_ioexception; Dialog dialog = new AlertDialog.Builder(getContext()).setIcon(R.drawable.ic_error_dark).setTitle(title) .setMessage(exception.getClass().getCanonicalName() + "\n" + exception.getLocalizedMessage()) .setNegativeButton(R.string.exception_show_details, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(getContext(), DebugInfoActivity.class); intent.putExtra(DebugInfoActivity.KEY_THROWABLE, exception); if (account != null) intent.putExtra(DebugInfoActivity.KEY_ACCOUNT, account); startActivity(intent); } }).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).create(); setCancelable(false); return dialog; }
From source file:ca.shoaib.ping.PingDetailActivityFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mPingDetail = savedInstanceState.getParcelable(KEY_DETAIL); } else {/* w w w . jav a 2s. c om*/ if (getArguments().containsKey(PingListActivity.PING_DETAIL)) mPingDetail = getArguments().getParcelable(PingListActivity.PING_DETAIL); } }
From source file:com.bmd.android.collection.example.EnhancedArrayMapTest.java
public void testParcelable() { final Bundle bundle = new Bundle(); bundle.putParcelable("array", mArray); final Parcel parcel = Parcel.obtain(); bundle.writeToParcel(parcel, 0);//w w w .j a va 2s.c om parcel.setDataPosition(0); final Bundle out = parcel.readBundle(); out.setClassLoader(AndroidCollections.class.getClassLoader()); assertThat(out.getParcelable("array")).isEqualTo(mArray); }