List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:net.naonedbus.activity.impl.CommentaireActivity.java
@Override protected void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(BUNDLE_KEY_LIGNE, mLigne); outState.putParcelable(BUNDLE_KEY_SENS, mSens); outState.putParcelable(BUNDLE_KEY_ARRET, mArret); }
From source file:com.google.sample.beaconservice.MainActivityFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); final ProgressBar progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar); progressBar.setProgress(0);//from ww w. j av a 2 s. c o m progressBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.MULTIPLY); scanButton = (Button) rootView.findViewById(R.id.scanButton); scanButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Utils.setEnabledViews(false, scanButton); arrayAdapter.clear(); scanner.startScan(SCAN_FILTERS, SCAN_SETTINGS, scanCallback); Log.i(TAG, "starting scan"); client = new ProximityBeaconImpl(getActivity(), accountNameView.getText().toString()); CountDownTimer countDownTimer = new CountDownTimer(SCAN_TIME_MILLIS, 100) { @Override public void onTick(long millisUntilFinished) { double i = (1 - millisUntilFinished / (double) SCAN_TIME_MILLIS) * 100; progressBar.setProgress((int) i); } @Override public void onFinish() { progressBar.setProgress(100); } }; countDownTimer.start(); Runnable stopScanning = new Runnable() { @Override public void run() { scanner.stopScan(scanCallback); Log.i(TAG, "stopped scan"); Utils.setEnabledViews(true, scanButton); } }; handler.postDelayed(stopScanning, SCAN_TIME_MILLIS); } }); accountNameView = (TextView) rootView.findViewById(R.id.accountName); accountNameView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pickUserAccount(); } }); // Set the account name from the shared prefs if we ever set it before. String accountName = sharedPreferences.getString("accountName", ""); if (!accountName.isEmpty()) { accountNameView.setText(accountName); } else { pickUserAccount(); } ListView listView = (ListView) rootView.findViewById(R.id.listView); listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Beacon beacon = arrayAdapter.getItem(position); if (beacon.status.equals(Beacon.NOT_AUTHORIZED)) { new AlertDialog.Builder(getActivity()).setTitle("Not Authorized") .setMessage("You don't have permission to view the details of this beacon") .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).show(); return; } if (beacon.status.equals(Beacon.STATUS_UNSPECIFIED)) { return; } Bundle bundle = new Bundle(); bundle.putString("accountName", accountNameView.getText().toString()); bundle.putParcelable("beacon", arrayAdapter.getItem(position)); ManageBeaconFragment fragment = new ManageBeaconFragment(); fragment.setArguments(bundle); getFragmentManager().beginTransaction().replace(R.id.container, fragment).addToBackStack(TAG) .commit(); } }); return rootView; }
From source file:com.android.messaging.ui.UIIntentsImpl.java
@Override public void launchPhoneCallActivity(final Context context, final String phoneNumber, final Point clickPosition) { final Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(UriUtil.SCHEME_TEL + phoneNumber)); final Bundle extras = new Bundle(); extras.putParcelable(CALL_TARGET_CLICK_KEY, clickPosition); intent.putExtra(CALL_TARGET_CLICK_EXTRA_KEY, extras); startExternalActivity(context, intent); }
From source file:ca.rmen.android.scrumchatter.main.MainActivity.java
/** * Import the given database file. This will replace the current database. *//*from w w w . j a v a 2 s . co m*/ private void importDB(final Uri uri) { Bundle extras = new Bundle(1); extras.putParcelable(EXTRA_IMPORT_URI, uri); DialogFragmentFactory.showConfirmDialog(this, getString(R.string.import_confirm_title), getString(R.string.import_confirm_message, uri.getEncodedPath()), R.id.action_import, extras); }
From source file:com.sonetel.plugins.sonetelcallback.CallBack.java
@Override public void onReceive(final Context context, Intent intent) { if (SipManager.ACTION_GET_PHONE_HANDLERS.equals(intent.getAction())) { // Retrieve and cache infos from the phone app if (!sPhoneAppInfoLoaded) { Resources r = context.getResources(); BitmapDrawable drawable = (BitmapDrawable) r.getDrawable(R.drawable.ic_wizard_sonetel); sPhoneAppBmp = drawable.getBitmap(); sPhoneAppInfoLoaded = true;//from w w w . j av a 2 s . c o m } Bundle results = getResultExtras(true); //if(pendingIntent != null) { // results.putParcelable(CallHandlerPlugin.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent); //} results.putString(Intent.EXTRA_TITLE, "Call back");// context.getResources().getString(R.string.use_pstn)); if (sPhoneAppBmp != null) { results.putParcelable(Intent.EXTRA_SHORTCUT_ICON, sPhoneAppBmp); } if (intent.getStringExtra(Intent.EXTRA_TEXT) == null) return; final String dialledNum = intent.getStringExtra(Intent.EXTRA_TEXT); final String callthrunum = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); DBAdapter dbAdapt = new DBAdapter(context); // Build pending intent SipAccount = dbAdapt.getAccount(1); if (SipAccount != null) { //Intent i = new Intent(Intent.ACTION_CALL); //i.setData(Uri.fromParts("tel", callthrunum, null)); //final PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); NetWorkThread = new Thread() { public void run() { SendMsgToNetWork(dialledNum, callthrunum, context, null); }; }; NetWorkThread.start(); } else if (SipAccount.acc_id != "1") Toast.makeText(context, "Unable to find Sonetel account. Please sign in using your Sonetel account", Toast.LENGTH_LONG).show(); if (!dialledNum.equalsIgnoreCase("")) { SipCallSessionImpl callInfo = new SipCallSessionImpl(); callInfo.setRemoteContact(dialledNum); callInfo.setIncoming(false); callInfo.callStart = System.currentTimeMillis(); callInfo.setAccId(4); //callInfo.setLastStatusCode(pjsua.PJ_SUCCESS); ContentValues cv = CallLogHelper.logValuesForCall(context, callInfo, callInfo.callStart); context.getContentResolver().insert(SipManager.CALLLOG_URI, cv); } //} //else //{ //} } // This will exclude next time tel:xxx is raised from csipsimple treatment which is wanted //results.putString(Intent.EXTRA_PHONE_NUMBER, callthrunum); }
From source file:com.appeaser.sublimepicker.Sampler.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sampler);// w w w . j av a 2 s .c o m Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } // Finish on navigation icon click toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); ivLaunchPicker = (ImageView) findViewById(R.id.ivLaunchPicker); cbDatePicker = (CheckBox) findViewById(R.id.cbDatePicker); cbTimePicker = (CheckBox) findViewById(R.id.cbTimePicker); cbRecurrencePicker = (CheckBox) findViewById(R.id.cbRecurrencePicker); rbDatePicker = (RadioButton) findViewById(R.id.rbDatePicker); rbTimePicker = (RadioButton) findViewById(R.id.rbTimePicker); rbRecurrencePicker = (RadioButton) findViewById(R.id.rbRecurrencePicker); tvPickerToShow = (TextView) findViewById(R.id.tvPickerToShow); tvActivatedPickers = (TextView) findViewById(R.id.tvActivatedPickers); svMainContainer = (ScrollView) findViewById(R.id.svMainContainer); cbAllowDateRangeSelection = (CheckBox) findViewById(R.id.cbAllowDateRangeSelection); llDateHolder = (LinearLayout) findViewById(R.id.llDateHolder); llDateRangeHolder = (LinearLayout) findViewById(R.id.llDateRangeHolder); // Initialize views to display the chosen Date, Time & Recurrence options tvYear = ((TextView) findViewById(R.id.tvYear)); tvMonth = ((TextView) findViewById(R.id.tvMonth)); tvDay = ((TextView) findViewById(R.id.tvDay)); tvStartDate = ((TextView) findViewById(R.id.tvStartDate)); tvEndDate = ((TextView) findViewById(R.id.tvEndDate)); tvHour = ((TextView) findViewById(R.id.tvHour)); tvMinute = ((TextView) findViewById(R.id.tvMinute)); tvRecurrenceOption = ((TextView) findViewById(R.id.tvRecurrenceOption)); tvRecurrenceRule = ((TextView) findViewById(R.id.tvRecurrenceRule)); rlDateTimeRecurrenceInfo = (RelativeLayout) findViewById(R.id.rlDateTimeRecurrenceInfo); ivLaunchPicker.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); ivLaunchPicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // DialogFragment to host SublimePicker SublimePickerFragment pickerFrag = new SublimePickerFragment(); pickerFrag.setCallback(mFragmentCallback); // Options Pair<Boolean, SublimeOptions> optionsPair = getOptions(); if (!optionsPair.first) { // If options are not valid Toast.makeText(Sampler.this, "No pickers activated", Toast.LENGTH_SHORT).show(); return; } // Valid options Bundle bundle = new Bundle(); bundle.putParcelable("SUBLIME_OPTIONS", optionsPair.second); pickerFrag.setArguments(bundle); pickerFrag.setStyle(DialogFragment.STYLE_NO_TITLE, 0); pickerFrag.show(getSupportFragmentManager(), "SUBLIME_PICKER"); } }); // De/activates Date Picker cbDatePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rbDatePicker.setVisibility(cbDatePicker.isChecked() ? View.VISIBLE : View.GONE); onActivatedPickersChanged(); } }); // De/activates Time Picker cbTimePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rbTimePicker.setVisibility(cbTimePicker.isChecked() ? View.VISIBLE : View.GONE); onActivatedPickersChanged(); } }); // De/activates Recurrence Picker cbRecurrencePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rbRecurrencePicker.setVisibility(cbRecurrencePicker.isChecked() ? View.VISIBLE : View.GONE); onActivatedPickersChanged(); } }); cbAllowDateRangeSelection.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); // restore state dealWithSavedInstanceState(savedInstanceState); }
From source file:androidx.media.SessionToken2.java
/** * Create a {@link Bundle} from this token to share it across processes. * @return Bundle/* ww w. j a va 2s . c o m*/ */ public Bundle toBundle() { Bundle bundle = new Bundle(); bundle.putInt(KEY_UID, mUid); bundle.putString(KEY_PACKAGE_NAME, mPackageName); bundle.putString(KEY_SERVICE_NAME, mServiceName); bundle.putString(KEY_ID, mId); bundle.putInt(KEY_TYPE, mType); bundle.putParcelable(KEY_SESSION_TOKEN, mSessionCompatToken); return bundle; }
From source file:ch.berta.fabio.fabprogress.FabProgress.java
@Override protected Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); bundle.putBoolean(STATE_COMPLETE, mIsComplete); bundle.putInt(STATE_ANIM, mAnimState); return bundle; }
From source file:com.cerema.cloud2.ui.preview.PreviewImageFragment.java
/** * {@inheritDoc}//ww w . j a v a2 s . com */ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(PreviewImageFragment.EXTRA_FILE, getFile()); }
From source file:com.bloc.blocparty.TimelineFragment.java
public void uploadPhoto() { Bundle params = new Bundle(); params.putParcelable("source", bm); // params.putString("source-comments", "comments"); /* make the API call */ new Request(Session.getActiveSession(), "/me/photos", params, HttpMethod.POST, new Request.Callback() { public void onCompleted(Response response) { /* handle the result */ Log.d("uploadPhoto", "upload onComplete"); }//from www . j ava2s . com }).executeAsync(); }