List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:com.commonsware.android.videorecord.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { output = new File(new File(getFilesDir(), VIDEOS), FILENAME); if (output.exists()) { output.delete();//from w ww . ja v a2 s . c o m } else { output.getParentFile().mkdirs(); } } else { output = (File) savedInstanceState.getSerializable(EXTRA_FILENAME); } outputUri = FileProvider.getUriForFile(this, AUTHORITY, output); if (savedInstanceState == null) { Intent i = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); i.putExtra(MediaStore.EXTRA_OUTPUT, outputUri); i.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { i.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } else { List<ResolveInfo> resInfoList = getPackageManager().queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; grantUriPermission(packageName, outputUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } } startActivityForResult(i, REQUEST_ID); } }
From source file:org.mifos.androidclient.main.CentersListActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.centers_list); CollectionSheetHolder.setCOLLECTION_SHEET(1); if (bundle != null && bundle.containsKey(CustomersData.BUNDLE_KEY)) { mCustomersData = (CustomersData) bundle.getSerializable(CustomersData.BUNDLE_KEY); }// w w w .j a va2 s .co m mFilterBox = (EditText) findViewById(R.id.centers_list_filter_box); mCentersList = (ListView) findViewById(R.id.centers_list); mContent = (LinearLayout) findViewById(R.id.centersList_content); mMessage = (TextView) findViewById(R.id.centersList_noDataMessage); mCustomerService = new CustomerService(this); }
From source file:com.marianhello.bgloc.Config.java
private Config(Parcel in) { setStationaryRadius(in.readFloat()); setDistanceFilter(in.readInt());/* w w w. j a v a2 s . c o m*/ setDesiredAccuracy(in.readInt()); setDebugging((Boolean) in.readValue(null)); setNotificationTitle(in.readString()); setNotificationText(in.readString()); setLargeNotificationIcon(in.readString()); setSmallNotificationIcon(in.readString()); setNotificationIconColor(in.readString()); setStopOnTerminate((Boolean) in.readValue(null)); setStartOnBoot((Boolean) in.readValue(null)); setStartForeground((Boolean) in.readValue(null)); setLocationProvider(in.readInt()); setInterval(in.readInt()); setFastestInterval(in.readInt()); setActivitiesInterval(in.readInt()); setStopOnStillActivity((Boolean) in.readValue(null)); setUrl(in.readString()); setSyncUrl(in.readString()); setSyncThreshold(in.readInt()); setMaxLocations(in.readInt()); Bundle bundle = in.readBundle(); setHttpHeaders((HashMap<String, String>) bundle.getSerializable("httpHeaders")); }
From source file:com.alivenet.dmvtaxi.fragment.FragmentRateYourRide.java
@Override public void onResume() { super.onResume(); Bundle bundle = this.getArguments(); rideDriverComplete = (RideDriverComplete) bundle.getSerializable("ridedriverInfo"); if (rideDriverComplete != null) { Text_tripcomplete_pickuplocation.setText(rideDriverComplete.getPickupaddress()); Text_tripcomplete_dropoff_location.setText(rideDriverComplete.getDestinationaddress()); mname.setText(rideDriverComplete.driverNameride); mlicenceplate.setText(rideDriverComplete.licenseId); Text_tripcharged//ww w . j a v a2 s.c o m .setText("$" + rideDriverComplete.getTotalfare() + " HAS BEEN CHARGED TO YOUR CREDIT CARD"); mtaname.setText(rideDriverComplete.vehicle); sharedPreference.SaveRideComplete(getActivity(), rideDriverComplete); System.out.println("drivernameridecomplete" + rideDriverComplete.getDriverNameride()); System.out.println("tripcomplete" + rideDriverComplete.getTotalfare()); } }
From source file:org.mifos.androidclient.main.OverdueBorrowersListActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.overdue_borrowers_list); if (bundle != null && bundle.containsKey(CustomersData.BUNDLE_KEY)) { mOverdueCustomers = Arrays .asList((OverdueCustomer[]) bundle.getSerializable(OverdueCustomer.BUNDLE_KEY)); }/*from ww w . j av a 2s. c o m*/ mFilterBox = (EditText) findViewById(R.id.overdueBorrowersList_filter_box); mOverdueBorrowersList = (ExpandableListView) findViewById(R.id.overdueBorrowersList_list); mContent = (LinearLayout) findViewById(R.id.overdueBorrowersList_content); mMessage = (TextView) findViewById(R.id.overdueBorrowersList_noDataMessage); mCustomerService = new CustomerService(this); }
From source file:com.esri.arcgisruntime.sample.hillshaderenderer.ParametersDialogFragment.java
/** * Builds a parameter dialog box with values pulled through from MainActivity. * @param savedInstanceState bundle holding previous activity's saved state * @return create parameter dialog box//from ww w . ja va 2s . com */ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); Bundle hillshadeParameters = getArguments(); if (hillshadeParameters != null) { mAltitude = hillshadeParameters.getInt("altitude"); mAzimuth = hillshadeParameters.getInt("azimuth"); mSlopeType = (SlopeType) hillshadeParameters.getSerializable("slope_type"); } AlertDialog.Builder paramDialog = new AlertDialog.Builder(getContext()); @SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.hillshade_dialog_box, null); paramDialog.setView(dialogView); paramDialog.setTitle(R.string.dialog_title); paramDialog.setNegativeButton("Cancel", (dialog, which) -> dismiss()); paramDialog.setPositiveButton("Render", (dialog, which) -> { ParametersListener activity = (ParametersListener) getActivity(); activity.returnParameters(mAltitude, mAzimuth, mSlopeType); }); mCurrAltitudeTextView = dialogView.findViewById(R.id.hillshade_curr_altitude_text); SeekBar altitudeSeekBar = dialogView.findViewById(R.id.hillshade_altitude_seek_bar); altitudeSeekBar.setMax(90); //altitude is restricted to 0 - 90 //set initial altitude value updateAltitudeSeekBar(altitudeSeekBar); altitudeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mAltitude = progress; updateAltitudeSeekBar(seekBar); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); mCurrAzimuthTextView = dialogView.findViewById(R.id.hillshade_curr_azimuth_text); SeekBar azimuthSeekBar = dialogView.findViewById(R.id.hillshade_azimuth_seek_bar); azimuthSeekBar.setMax(360); //azimuth measured in degrees 0 - 360 //set initial azimuth value updateAzimuthSeekBar(azimuthSeekBar); azimuthSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mAzimuth = progress; updateAzimuthSeekBar(seekBar); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); List<String> slopeTypeArray = new ArrayList<>(); slopeTypeArray.add("None"); //ordinals:0 slopeTypeArray.add("Degree"); //1 slopeTypeArray.add("Percent rise"); //2 slopeTypeArray.add("Scaled"); //3 ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.hillshade_spinner_text_view, slopeTypeArray); Spinner slopeTypeSpinner = dialogView.findViewById(R.id.hillshade_slope_type_spinner); slopeTypeSpinner.setAdapter(spinnerAdapter); slopeTypeSpinner.setSelection(mSlopeType.ordinal()); slopeTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: mSlopeType = SlopeType.NONE; break; case 1: mSlopeType = SlopeType.DEGREE; break; case 2: mSlopeType = SlopeType.PERCENT_RISE; break; case 3: mSlopeType = SlopeType.SCALED; break; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); return paramDialog.create(); }
From source file:eu.geopaparazzi.library.forms.FormDetailFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle arguments = getArguments(); if (arguments != null) mFormInfoHolder = (FormInfoHolder) arguments.getSerializable(ARGS_FORMINFO); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); }
From source file:com.orange.labs.sdk.session.AuthSession.java
/** * Check if authentication is successfull. * @param success/* w ww .j av a2s. co m*/ * @param failure */ public void checkAuthentication(final OrangeListener.Success<String> success, final OrangeListener.Error failure) { String refreshToken = getRefreshToken(); // Check Refresh Token if (refreshToken == null || refreshToken.length() == 0) { // Check the result of AuthActivity // Check if an error occurred Intent data = AuthActivity.result; if (data != null) { Bundle extras = data.getExtras(); OrangeAPIException exception = (OrangeAPIException) extras .getSerializable(AuthActivity.EXTRA_EXCEPTION_ERROR); if (exception != null) { failure.onErrorResponse(exception); } else { // Check the authorization code to return an access token, refresh token... // Prepare URL String url = API_SERVER + "/oauth/v2/token"; // Prepare params in body request JSONObject params = new JSONObject(); try { params.put("grant_type", "authorization_code"); params.put("code", data.getStringExtra(AuthActivity.EXTRA_AUTHORIZATION_CODE)); params.put("redirect_uri", redirectURI); getRestClient().jsonRequest("/session/check/authorizationCode", Request.Method.POST, url, params, getHeaders(), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { // save values : accessToken = response.optString("access_token"); setExpiresIn(response.optInt("expires_in")); setRefreshToken(response.optString("refresh_token")); // Check that authent is success ! SharedPreferences sharedPref = context .getSharedPreferences(SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putBoolean(SHARED_PREFERENCES_FORCE_LOGIN, false); editor.commit(); success.onResponse("OK"); } }, failure); } catch (JSONException e) { failure.onErrorResponse(new OrangeAPIException()); } } } } else { // get the access token with refresh token refresh(success, failure); } }
From source file:org.mifos.androidclient.main.CustomerChargesDetailsActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.customer_charges_details); mCustomer = (AbstractCustomer) getIntent().getSerializableExtra(AbstractCustomer.BUNDLE_KEY); if (bundle != null) { mDetails = (CustomerChargesDetails) bundle.getSerializable(CustomerChargesDetails.BUNDLE_KEY); }// ww w. j a v a 2 s . c o m mCustomerService = new CustomerService(this); }