List of usage examples for android.os Bundle getParcelable
@Nullable public <T extends Parcelable> T getParcelable(@Nullable String key)
From source file:com.binary_machinery.avalonschedule.view.schedule.SchedulePageFragment.java
@Nullable @Override/*from w w w . j av a2 s.c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.schedule_page, container, false); Bundle arguments = getArguments(); FragmentManager fragmentManager = getChildFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); Func2<Integer, Integer, ?> setRecord = (dayOfWeek, layoutId) -> { String key = ARG_DAY + dayOfWeek; ScheduleRecord record = arguments.getParcelable(key); if (record != null) { Fragment fragment = (record.course != null) ? new RecordFragment() : new EmptyRecordFragment(); Bundle args = new Bundle(); args.putParcelable(RecordFragment.ARG_RECORD, record); fragment.setArguments(args); fragmentTransaction.replace(layoutId, fragment); } return 0; }; setRecord.call(Calendar.MONDAY, R.id.layoutMonday); setRecord.call(Calendar.TUESDAY, R.id.layoutTuesday); setRecord.call(Calendar.WEDNESDAY, R.id.layoutWednesday); setRecord.call(Calendar.THURSDAY, R.id.layoutThursday); setRecord.call(Calendar.FRIDAY, R.id.layoutFriday); setRecord.call(Calendar.SATURDAY, R.id.layoutSaturday); setRecord.call(Calendar.SUNDAY, R.id.layoutSunday); fragmentTransaction.commit(); return rootView; }
From source file:com.meetingninja.csse.user.ProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { pageView = inflater.inflate(R.layout.fragment_profile, container, false); setupViews(pageView);//from ww w . j a v a 2 s . c o m session = SessionManager.getInstance(); Bundle extras = getArguments(); displayedUser = new User(); if (extras != null && extras.containsKey(Keys.User.PARCEL)) { displayedUser = ((UserParcel) extras.getParcelable(Keys.User.PARCEL)).getUser(); try { System.out.println(JsonUtils.getObjectMapper().writeValueAsString(displayedUser)); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Log.v(TAG, "Displaying Current User"); displayedUser.setID(session.getUserID()); } if (extras != null && extras.containsKey("notMine")) { menu = R.menu.menu_profile; } else { menu = R.menu.menu_view_profile; } setHasOptionsMenu(true); fetchUserInfo(displayedUser.getID()); return pageView; }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.search.video.SignSearchVideoActivity.java
@NonNull private Parcelable getParcelable() { final Intent intent = getIntent(); final Bundle bundle = intent.getBundleExtra(EXTRA); Validate.notNull(bundle, "The bundle supplied to the activity is null."); this.originalQuery = bundle.getString(SignSearchActivity.QUERY); Validate.notNull(this.originalQuery, "Query string supplied to this activity is null."); final Parcelable parcelledSign = bundle.getParcelable(SignVideoFragment.SIGN_TO_SHOW); Validate.notNull(parcelledSign, "Parcelled sign supplied to this activity is null."); return parcelledSign; }
From source file:de.golov.zeitgeistreich.ZeitGeistReichActivity.java
protected void submitImage(String tags) { Intent intent = getIntent();//ww w . j av a 2 s .co m Bundle extras = intent.getExtras(); Uri mImageUri = null; File mFilename = null; if (Intent.ACTION_SEND.equals(intent.getAction()) && extras != null) { if (extras.containsKey(Intent.EXTRA_STREAM)) { mImageUri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM); if (mImageUri != null) { Cursor cursor = getContentResolver().query(mImageUri, null, null, null, null); if (cursor.moveToFirst()) { mFilename = new File(cursor.getString(cursor.getColumnIndexOrThrow(ImageColumns.DATA))); } cursor.close(); if (mFilename != null) { ZeitGeistReichUploaderTask task = new ZeitGeistReichUploaderTask(); ZeitGeistObject o = new ZeitGeistObject(mFilename, tags); task.execute(o); } } } } }
From source file:com.alley.android.ppi.app.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); if (arguments != null) { mDetailUri = arguments.getParcelable(DetailFragment.DETAIL_URI); String address = PropertyContract.PropertyEntry.getAddressFromUri(mDetailUri); mDetailImageUri = PropertyContract.ImageEntry.buildImageUriFromAddress(address); ;//from w ww . jav a 2 s . c om } View rootView = inflater.inflate(R.layout.fragment_detail, container, false); mIconView = (ImageView) rootView.findViewById(R.id.detail_icon); mDateView = (TextView) rootView.findViewById(R.id.detail_date_textview); mDescriptionView = (TextView) rootView.findViewById(R.id.detail_address_textview); mPriceView = (TextView) rootView.findViewById(R.id.detail_price_textview); mContentDescription = (TextView) rootView.findViewById(R.id.detail_content_description_textview); mFeaturesDescription = (TextView) rootView.findViewById(R.id.detail_features_textview); mAccommodation = (TextView) rootView.findViewById(R.id.detail_accommodation_textview); mBer = (TextView) rootView.findViewById(R.id.detail_ber_textview); mTitleDescription = (TextView) rootView.findViewById(R.id.detail_title_description_textview); mTitleFeatures = (TextView) rootView.findViewById(R.id.detail_title_features_textview); mTitleAccommodation = (TextView) rootView.findViewById(R.id.detail_title_accommodation_textview); mTitleBer = (TextView) rootView.findViewById(R.id.detail_title_ber_textview); recList = (RecyclerView) rootView.findViewById(R.id.cardList); recList.setHasFixedSize(true); LinearLayoutManager llm = new LinearLayoutManager(getActivity()); llm.setOrientation(LinearLayoutManager.HORIZONTAL); recList.setLayoutManager(llm); imageAdapter = new DetailImageAdapter(this.getActivity(), null, getScreenSize()); recList.setAdapter(imageAdapter); return rootView; }
From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java
@Override public void onRestoreInstanceState(Parcelable parcelable) { if (parcelable instanceof Bundle) { Bundle bundle = (Bundle) parcelable; setState(MainActivity.State.valueOf(bundle.getString(STATE_CONTAINERS_STATE))); parcelable = bundle.getParcelable(STATE_SUPER); }/*from w w w .j a v a2s . co m*/ super.onRestoreInstanceState(parcelable); }
From source file:com.business.rushour.businessapp.TabOwnerRegistrationActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // if the result is capturing Image if (requestCode == PICK_IMAGE_REQUEST) { if (resultCode == RESULT_OK) { fileUri = data.getData();/*from ww w .j a va 2 s . c om*/ // successfully captured the image // display it in image view previewCapturedImage(); } } else if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) { if (resultCode == RESULT_OK) { previewCapturedImage(); } } else if (requestCode == PIC_CROP) { // user cancelled Image capture Bundle extras = data.getExtras(); //get the cropped bitmap Bitmap thePic = extras.getParcelable("data"); //uploadphoto.setImageBitmap(thePic); } }
From source file:com.chromium.fontinstaller.ui.install.PreviewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_preview, container, false); ButterKnife.inject(this, view); alphabetUpper = getString(R.string.alphabet_upper); alphabetLower = getString(R.string.alphabet_lower); if (savedInstanceState != null) { fontPackage = savedInstanceState.getParcelable(STATE_FONT_PACKAGE); style = savedInstanceState.getParcelable(STATE_FONT_STYLE); upperCase = savedInstanceState.getBoolean(STATE_UPPER_CASE); }/* w ww. ja v a2s .c o m*/ previewText.setTypeface(fontPackage.getTypeface(style, getActivity())); previewText.setText(getAlphabet()); return view; }
From source file:com.gmail.altakey.lucene.AsyncImageLoader.java
private InputStream read(ProgressReportingInputStream.ProgressListener listener) throws FileNotFoundException { final Context context = this.view.getContext(); if (Intent.ACTION_SEND.equals(this.intent.getAction())) { final Bundle extras = this.intent.getExtras(); if (extras.containsKey(Intent.EXTRA_STREAM)) return new ProgressReportingInputStream(context.getContentResolver() .openInputStream((Uri) extras.getParcelable(Intent.EXTRA_STREAM)), listener); if (extras.containsKey(Intent.EXTRA_TEXT)) { try { final HttpGet req = new HttpGet(extras.getCharSequence(Intent.EXTRA_TEXT).toString()); return new ProgressReportingInputStream(this.httpClient.execute(req).getEntity().getContent(), listener);//from w w w. j a va2s . c o m } catch (IllegalArgumentException e) { return null; } catch (IOException e) { return null; } } } if (Intent.ACTION_VIEW.equals(this.intent.getAction())) return new ProgressReportingInputStream( context.getContentResolver().openInputStream(this.intent.getData()), listener); return null; }
From source file:com.purplefrog.glitchclocka.LearningReadout.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); learningState = savedInstanceState.getParcelable("learningState"); glitch.accessToken = savedInstanceState.getString("glitchToken"); }