List of usage examples for android.os Bundle putSerializable
@Override public void putSerializable(@Nullable String key, @Nullable Serializable value)
From source file:com.esri.arcgisruntime.sample.hillshaderenderer.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { ParametersDialogFragment paramDialog = new ParametersDialogFragment(); Bundle hillshadeParameters = new Bundle(); //send parameters to fragment hillshadeParameters.putInt("altitude", mAltitude); hillshadeParameters.putInt("azimuth", mAzimuth); hillshadeParameters.putSerializable("slope_type", mSlopeType); paramDialog.setArguments(hillshadeParameters); paramDialog.show(mFragmentManager, "param_dialog"); return super.onOptionsItemSelected(item); }
From source file:cmput301.f13t01.readstory.ReadFragmentActivity.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable(getResources().getString(R.string.story_id), storyId); }
From source file:com.esri.arcgisruntime.sample.blendrenderer.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { ParametersDialogFragment paramDialog = new ParametersDialogFragment(); Bundle blendParameters = new Bundle(); //send parameters to fragment blendParameters.putInt("altitude", mAltitude); blendParameters.putInt("azimuth", mAzimuth); blendParameters.putSerializable("slope_type", mSlopeType); blendParameters.putSerializable("color_ramp_type", mColorRampType); paramDialog.setArguments(blendParameters); paramDialog.show(mFragmentManager, "param_dialog"); return super.onOptionsItemSelected(item); }
From source file:com.github.mobile.ui.issue.IssuesPagerAdapter.java
@Override public Fragment getItem(int position) { IssueFragment fragment = new IssueFragment(); Bundle args = new Bundle(); if (repo != null) { args.putString(EXTRA_REPOSITORY_NAME, repo.getName()); User owner = repo.getOwner();//from w ww . ja v a 2 s . co m args.putString(EXTRA_REPOSITORY_OWNER, owner.getLogin()); args.putSerializable(EXTRA_USER, owner); } else { RepositoryId repo = repos.get(position); args.putString(EXTRA_REPOSITORY_NAME, repo.getName()); args.putString(EXTRA_REPOSITORY_OWNER, repo.getOwner()); RepositoryIssue issue = store.getIssue(repo, issues[position]); if (issue != null && issue.getUser() != null) { Repository fullRepo = issue.getRepository(); if (fullRepo != null && fullRepo.getOwner() != null) args.putSerializable(EXTRA_USER, fullRepo.getOwner()); } } args.putInt(EXTRA_ISSUE_NUMBER, issues[position]); fragment.setArguments(args); return fragment; }
From source file:com.firebase.ui.auth.ui.phone.PhoneVerificationActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { outState.putSerializable(KEY_STATE, mVerificationState); outState.putString(KEY_VERIFICATION_PHONE, mPhoneNumber); super.onSaveInstanceState(outState); }
From source file:fi.mikuz.boarder.gui.internet.Login.java
@Override public void onConnectionSuccessful(ConnectionSuccessfulResponse connectionSuccessfulResponse) throws JSONException { ConnectionUtils.connectionSuccessful(Login.this, connectionSuccessfulResponse); mWaitDialog.dismiss();//w ww . j a v a2s .c o m if (ConnectionUtils.checkConnectionId(connectionSuccessfulResponse, InternetMenu.mLogoutURL)) { Toast.makeText(Login.this, connectionSuccessfulResponse.getJSONObject().getString(ConnectionUtils.returnMessage), Toast.LENGTH_LONG).show(); logout(); } else if (ConnectionUtils.checkConnectionId(connectionSuccessfulResponse, InternetMenu.mLoginURL)) { String password = connectionSuccessfulResponse.getJSONObject().getString(InternetMenu.PASSWORD_KEY); String sessionToken = connectionSuccessfulResponse.getJSONObject() .getString(InternetMenu.SESSION_TOKEN_KEY); String userId = connectionSuccessfulResponse.getJSONObject().getString(InternetMenu.USER_ID_KEY); String accountMessage = connectionSuccessfulResponse.getJSONObject() .getString(InternetMenu.ACCOUNT_MESSAGE_KEY); if (mRememberSession) { mDbHelper.createLogin(InternetMenu.USER_ID_KEY, userId); mDbHelper.createLogin(InternetMenu.SESSION_TOKEN_KEY, sessionToken); } if (mPasswordOperation == PASSWORD_OPERATION_SAVE) { mDbHelper.putLogin(InternetMenu.PASSWORD_KEY, password); } mReturnSession = new HashMap<String, String>(); mReturnSession.put(InternetMenu.USER_ID_KEY, userId); mReturnSession.put(InternetMenu.SESSION_TOKEN_KEY, sessionToken); Bundle bundle = new Bundle(); bundle.putSerializable(InternetMenu.LOGIN_KEY, mReturnSession); bundle.putString(InternetMenu.ACCOUNT_MESSAGE_KEY, accountMessage); Intent intent = new Intent(); intent.putExtras(bundle); setResult(RESULT_OK, intent); finish(); } else if (ConnectionUtils.checkConnectionId(connectionSuccessfulResponse, InternetMenu.mRecoverPasswordURL)) { Toast.makeText(Login.this, connectionSuccessfulResponse.getJSONObject().getString(ConnectionUtils.returnMessage), Toast.LENGTH_LONG).show(); } }
From source file:com.money.manager.ex.reports.PayeeReportFragment.java
public void showChart() { PayeeReportAdapter adapter = (PayeeReportAdapter) getListAdapter(); if (adapter == null) return;/*from w w w . j a v a2s . co m*/ Cursor cursor = adapter.getCursor(); if (cursor == null) return; if (!cursor.moveToFirst()) return; ArrayList<ValuePieEntry> arrayList = new ArrayList<ValuePieEntry>(); while (!cursor.isAfterLast()) { ValuePieEntry item = new ValuePieEntry(); // total double total = Math.abs(cursor.getDouble(cursor.getColumnIndex("TOTAL"))); if (!TextUtils.isEmpty(cursor.getString(cursor.getColumnIndex(ViewMobileData.PAYEE)))) { item.setText(cursor.getString(cursor.getColumnIndex(ViewMobileData.PAYEE))); } else { item.setText(getString(R.string.empty_payee)); } item.setValue(total); CurrencyService currencyService = new CurrencyService(getContext()); item.setValueFormatted(currencyService.getBaseCurrencyFormatted(MoneyFactory.fromDouble(total))); // add element arrayList.add(item); // move to next record cursor.moveToNext(); } Bundle args = new Bundle(); args.putSerializable(PieChartFragment.KEY_CATEGORIES_VALUES, arrayList); //get fragment manager FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); if (fragmentManager != null) { PieChartFragment fragment; fragment = (PieChartFragment) fragmentManager .findFragmentByTag(IncomeVsExpensesChartFragment.class.getSimpleName()); if (fragment == null) { fragment = new PieChartFragment(); } fragment.setChartArguments(args); fragment.setDisplayHomeAsUpEnabled(true); if (fragment.isVisible()) fragment.onResume(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if (((PayeesReportActivity) getActivity()).mIsDualPanel) { fragmentTransaction.replace(R.id.fragmentChart, fragment, PieChartFragment.class.getSimpleName()); } else { fragmentTransaction.replace(R.id.fragmentMain, fragment, PieChartFragment.class.getSimpleName()); fragmentTransaction.addToBackStack(null); } try { fragmentTransaction.commit(); } catch (IllegalStateException e) { Timber.e(e, "adding fragment"); } } }
From source file:com.elixsr.portforwarder.ui.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable(FORWARDING_MANAGER_KEY, this.forwardingManager); }
From source file:com.janela.mobile.ui.issue.IssuesPagerAdapter.java
@Override public Fragment getItem(int position) { IssueFragment fragment = new IssueFragment(); Bundle args = new Bundle(); if (repo != null) { args.putString(EXTRA_REPOSITORY_NAME, repo.getName()); User owner = repo.getOwner();/*w ww. jav a2s . co m*/ args.putString(EXTRA_REPOSITORY_OWNER, owner.getLogin()); args.putSerializable(EXTRA_USER, owner); } else { RepositoryId repo = repos.get(position); args.putString(EXTRA_REPOSITORY_NAME, repo.getName()); args.putString(EXTRA_REPOSITORY_OWNER, repo.getOwner()); RepositoryIssue issue = store.getIssue(repo, issues[position]); if (issue != null && issue.getUser() != null) { Repository fullRepo = issue.getRepository(); if (fullRepo != null && fullRepo.getOwner() != null) args.putSerializable(EXTRA_USER, fullRepo.getOwner()); } } args.putInt(EXTRA_ISSUE_NUMBER, issues[position]); args.putBoolean(EXTRA_IS_COLLABORATOR, isCollaborator); fragment.setArguments(args); return fragment; }
From source file:org.zywx.wbpalmstar.platform.push.PushRecieveMsgReceiver.java
private void buildPushNotification(Context context, Intent intent, PushDataInfo dataInfo) { String title = dataInfo.getTitle(); String body = dataInfo.getAlert(); String message = dataInfo.getPushDataString(); Builder builder = new Builder(context); builder.setAutoCancel(true);// w ww . j a va2s .c om builder.setContentTitle(title); // builder.setContentText(body); // builder.setTicker(body); // ?? String[] remindType = dataInfo.getRemindType(); if (remindType != null) { if (remindType.length == 3) { builder.setDefaults(Notification.DEFAULT_ALL); } else { int defaults = 0; for (int i = 0; i < remindType.length; i++) { if ("sound".equalsIgnoreCase(remindType[i])) { defaults = Notification.DEFAULT_SOUND; continue; } if ("shake".equalsIgnoreCase(remindType[i])) { defaults = defaults | Notification.DEFAULT_VIBRATE; continue; } if ("breathe".equalsIgnoreCase(remindType[i])) { defaults = defaults | Notification.DEFAULT_LIGHTS; continue; } } builder.setDefaults(defaults); } } Resources res = context.getResources(); int icon = res.getIdentifier("icon", "drawable", intent.getPackage()); builder.setSmallIcon(icon); builder.setWhen(System.currentTimeMillis()); // String iconUrl = dataInfo.getIconUrl(); boolean isDefaultIcon = !TextUtils.isEmpty(iconUrl) && "default".equalsIgnoreCase(iconUrl); Bitmap bitmap = null; if (!isDefaultIcon) { bitmap = getIconBitmap(context, iconUrl); } String fontColor = dataInfo.getFontColor(); RemoteViews remoteViews = null; if (!TextUtils.isEmpty(fontColor)) { int color = BUtility.parseColor(fontColor); int alphaColor = parseAlphaColor(fontColor); remoteViews = new RemoteViews(intent.getPackage(), EUExUtil.getResLayoutID("push_notification_view")); // Title remoteViews.setTextViewText(EUExUtil.getResIdID("notification_title"), title); remoteViews.setTextColor(EUExUtil.getResIdID("notification_title"), color); // Body remoteViews.setTextViewText(EUExUtil.getResIdID("notification_body"), body); remoteViews.setTextColor(EUExUtil.getResIdID("notification_body"), alphaColor); // LargeIcon if (bitmap != null) { remoteViews.setImageViewBitmap(EUExUtil.getResIdID("notification_largeIcon"), bitmap); } else { remoteViews.setImageViewResource(EUExUtil.getResIdID("notification_largeIcon"), EUExUtil.getResDrawableID("icon")); } // Time SimpleDateFormat format = new SimpleDateFormat("HH:mm"); remoteViews.setTextViewText(EUExUtil.getResIdID("notification_time"), format.format(System.currentTimeMillis())); remoteViews.setTextColor(EUExUtil.getResIdID("notification_time"), alphaColor); builder.setContent(remoteViews); } Intent notiIntent = new Intent(context, EBrowserActivity.class); notiIntent.putExtra("ntype", F_TYPE_PUSH); notiIntent.putExtra("data", body); notiIntent.putExtra("message", message); Bundle bundle = new Bundle(); bundle.putSerializable(PushReportConstants.PUSH_DATA_INFO_KEY, dataInfo); notiIntent.putExtras(bundle); PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationNB, notiIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pendingIntent); NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = builder.build(); // Android v4bug2.3?Builder?NotificationRemoteView?? if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && remoteViews != null) { notification.contentView = remoteViews; } manager.notify(notificationNB, notification); notificationNB++; }