List of usage examples for android.os Bundle getBundle
@Nullable
public Bundle getBundle(@Nullable String key)
From source file:com.twilio.android.quickstart.MyGcmListenerService.java
/** * Called when message is received.// w ww . j a va 2 s. c om * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { /** * Our Node.js server adds the message body also to the Data bundle so that we can retrieve * it when the app is in the foreground and the notification gets delivered directly to it * without being added to the Notification Center. */ Bundle notification = data.getBundle("notification"); String body = ""; if (notification != null) { body = notification.getString("body"); } Log.d(TAG, "From: " + from); Log.d(TAG, "Body: " + body); // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ sendNotification(body); // [END_EXCLUDE] }
From source file:de.sourcestream.movieDB.controller.GenresList.java
/** * Called to do initial creation of a fragment. * This is called after onAttach(Activity) and before onCreateView(LayoutInflater, ViewGroup, Bundle). * * @param savedInstanceState If the fragment is being re-created from a previous saved state, this is the state. *//*www . j a v a 2s. c o m*/ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) save = savedInstanceState.getBundle("save"); }
From source file:io.github.hidroh.materialistic.BaseListFragment.java
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true);/* w w w . ja v a 2 s. c o m*/ if (savedInstanceState == null) { getAdapter().setCardViewEnabled(Preferences.isListItemCardView(getActivity())); } else { getAdapter().restoreState(savedInstanceState.getBundle(STATE_ADAPTER)); } }
From source file:bbct.android.common.activity.BaseballCardList.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = this.getArguments(); if (savedInstanceState != null) { this.filterParams = savedInstanceState.getBundle(FILTER_PARAMS); } else if (args != null) { this.filterParams = args.getBundle(FILTER_PARAMS); }/*from w ww . j a va 2s . co m*/ this.setHasOptionsMenu(true); }
From source file:com.dahl.brendan.wordsearch.view.controller.WordSearchActivityController.java
public void restoreState(Bundle inState) { if (inState != null) { Bundle hsBundle = inState.getBundle(BUNDLE_HIGH_SCORE); if (hsBundle != null) { hs = new HighScore(hsBundle); } else {// w w w .j a v a 2 s. c o m hs = null; } this.grid = inState.getParcelable(BUNDLE_GRID); this.setGrid(grid); wordSearch.setupViewGrid(); updateTheme(); this.timeSum = inState.getLong(BUNDLE_TIME, 0); } else { this.newWordSearch(); } }
From source file:ca.rmen.android.networkmonitor.app.dialog.ConfirmDialogFragment.java
/** * @return a Dialog with a title, message, ok, and cancel buttons. *//*from w ww. j a v a 2 s . co m*/ @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { Log.v(TAG, "onCreateDialog: savedInstanceState = " + savedInstanceState); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); Bundle arguments = getArguments(); builder.setTitle(arguments.getString(DialogFragmentFactory.EXTRA_TITLE)); builder.setMessage(arguments.getString(DialogFragmentFactory.EXTRA_MESSAGE)); final int actionId = arguments.getInt(DialogFragmentFactory.EXTRA_ACTION_ID); final Bundle extras = arguments.getBundle(DialogFragmentFactory.EXTRA_EXTRAS); OnClickListener positiveListener = null; OnClickListener negativeListener = null; if (getActivity() instanceof DialogButtonListener) { positiveListener = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Log.v(TAG, "onClick (positive button"); FragmentActivity activity = getActivity(); if (activity == null) Log.w(TAG, "User clicked on dialog after it was detached from activity. Monkey?"); else ((DialogButtonListener) activity).onOkClicked(actionId, extras); } }; negativeListener = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Log.v(TAG, "onClick (negative button"); FragmentActivity activity = getActivity(); if (activity == null) Log.w(TAG, "User clicked on dialog after it was detached from activity. Monkey?"); else ((DialogButtonListener) activity).onCancelClicked(actionId, extras); } }; } builder.setNegativeButton(android.R.string.cancel, negativeListener); builder.setPositiveButton(android.R.string.ok, positiveListener); if (getActivity() instanceof OnCancelListener) builder.setOnCancelListener((OnCancelListener) getActivity()); final Dialog dialog = builder.create(); if (getActivity() instanceof OnDismissListener) dialog.setOnDismissListener((OnDismissListener) getActivity()); return dialog; }
From source file:com.parse.applinksanalytics.ParseAppLinksBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); String eventName = intent.getExtras().getString(EVENT_NAME_KEY); // Only log custom event if it's recognized and in the map if (EVENT_NAME_MAP.containsKey(eventName)) { String eventNameMapped = EVENT_NAME_MAP.get(eventName); Map<String, String> dimensions = convertBundleToMap(extras.getBundle(EVENT_ARGS_KEY)); ParseAnalytics.trackEvent(eventNameMapped, dimensions); }/* w ww. j a v a2 s. com*/ }
From source file:com.gh4a.fragment.PagedDataBaseFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(getEmptyTextResId())); setContentShown(false);/*from w w w . j a v a 2 s .c o m*/ mIterator = (PageIteratorWithSaveableState<T>) onCreateIterator(); if (savedInstanceState != null) { mIterator.restoreState(savedInstanceState.getBundle(STATE_KEY_ITERATOR_STATE)); } getLoaderManager().initLoader(0, null, mLoaderCallback); }
From source file:fr.nover.yana.installWizard.Assistant_Installation.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { mWizardModel.load(savedInstanceState.getBundle("model")); }/*from w ww. j a v a2 s . com*/ mWizardModel.registerListener(this); mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mPagerAdapter); mStepPagerStrip = (StepPagerStrip) findViewById(R.id.strip); mStepPagerStrip.setOnPageSelectedListener(new StepPagerStrip.OnPageSelectedListener() { @Override public void onPageStripSelected(int position) { position = Math.min(mPagerAdapter.getCount() - 1, position); if (mPager.getCurrentItem() != position) { mPager.setCurrentItem(position); } } }); mNextButton = (Button) findViewById(R.id.next_button); mPrevButton = (Button) findViewById(R.id.prev_button); mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { mStepPagerStrip.setCurrentPage(position); if (mConsumePageSelectedEvent) { mConsumePageSelectedEvent = false; return; } mEditingAfterReview = false; updateBottomBar(); } }); final Intent get_config = new Intent(this, Config.class); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mPager.getCurrentItem() == mCurrentPageSequence.size()) { startActivity(get_config); finish(); } else { if (mEditingAfterReview) { mPager.setCurrentItem(mPagerAdapter.getCount() - 1); } else { mPager.setCurrentItem(mPager.getCurrentItem() + 1); } } } }); mPrevButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mPager.setCurrentItem(mPager.getCurrentItem() - 1); } }); onPageTreeChanged(); updateBottomBar(); }
From source file:fr.nover.yana.assistant_installation.Assistant_Installation.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { mWizardModel.load(savedInstanceState.getBundle("model")); }/* w w w . jav a 2s. c o m*/ mWizardModel.registerListener(this); mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mPagerAdapter); mStepPagerStrip = (StepPagerStrip) findViewById(R.id.strip); mStepPagerStrip.setOnPageSelectedListener(new StepPagerStrip.OnPageSelectedListener() { @Override public void onPageStripSelected(int position) { position = Math.min(mPagerAdapter.getCount() - 1, position); if (mPager.getCurrentItem() != position) { mPager.setCurrentItem(position); } } }); mNextButton = (Button) findViewById(R.id.next_button); mPrevButton = (Button) findViewById(R.id.prev_button); mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { mStepPagerStrip.setCurrentPage(position); if (mConsumePageSelectedEvent) { mConsumePageSelectedEvent = false; return; } mEditingAfterReview = false; updateBottomBar(); } }); final Intent get_config = new Intent(this, get_config.class); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mPager.getCurrentItem() == mCurrentPageSequence.size()) { startActivity(get_config); finish(); } else { if (mEditingAfterReview) { mPager.setCurrentItem(mPagerAdapter.getCount() - 1); } else { mPager.setCurrentItem(mPager.getCurrentItem() + 1); } } } }); mPrevButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mPager.setCurrentItem(mPager.getCurrentItem() - 1); } }); onPageTreeChanged(); updateBottomBar(); }