Example usage for android.os Bundle getBundle

List of usage examples for android.os Bundle getBundle

Introduction

In this page you can find the example usage for android.os Bundle getBundle.

Prototype

@Nullable
public Bundle getBundle(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.facebook.internal.FacebookDialogFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (this.dialog == null) {
        final FragmentActivity activity = getActivity();
        Intent intent = activity.getIntent();
        Bundle params = NativeProtocol.getMethodArgumentsFromIntent(intent);

        boolean isWebFallback = params.getBoolean(NativeProtocol.WEB_DIALOG_IS_FALLBACK, false);
        WebDialog webDialog;/*  w  ww. j a  va 2 s .c  om*/
        if (!isWebFallback) {
            String actionName = params.getString(NativeProtocol.WEB_DIALOG_ACTION);
            Bundle webParams = params.getBundle(NativeProtocol.WEB_DIALOG_PARAMS);
            if (Utility.isNullOrEmpty(actionName)) {
                Utility.logd(TAG, "Cannot start a WebDialog with an empty/missing 'actionName'");
                activity.finish();
                return;
            }

            webDialog = new WebDialog.Builder(activity, actionName, webParams)
                    .setOnCompleteListener(new WebDialog.OnCompleteListener() {
                        @Override
                        public void onComplete(Bundle values, FacebookException error) {
                            onCompleteWebDialog(values, error);
                        }
                    }).build();
        } else {
            String url = params.getString(NativeProtocol.WEB_DIALOG_URL);
            if (Utility.isNullOrEmpty(url)) {
                Utility.logd(TAG, "Cannot start a fallback WebDialog with an empty/missing 'url'");
                activity.finish();
                return;
            }

            String redirectUrl = String.format("fb%s://bridge/", FacebookSdk.getApplicationId());
            webDialog = new FacebookWebFallbackDialog(activity, url, redirectUrl);
            webDialog.setOnCompleteListener(new WebDialog.OnCompleteListener() {
                @Override
                public void onComplete(Bundle values, FacebookException error) {
                    // Error data is nested in the values since this is in the form of a
                    // Native protocol response
                    onCompleteWebFallbackDialog(values);
                }
            });
        }

        this.dialog = webDialog;
    }
}

From source file:com.example.flashcards.WizardActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wizard);

    if (savedInstanceState != null) {
        mWizardModel.load(savedInstanceState.getBundle("model"));
    }/*  w  w  w  . j  a  v a 2 s  . c om*/

    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 Activity activity = this;
    mNextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mPager.getCurrentItem() == mCurrentPageSequence.size()) {
                callNewWord();
                try {
                    activity.finish();
                } catch (Throwable e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } 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:com.hamsik2046.password.view.SingleInputFormActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);
    if (savedInstanceState != null) {
        setupData = savedInstanceState.getBundle(KEY_DATA);
        mStepIndex = savedInstanceState.getInt(KEY_STEP_INDEX, 0);
    }//w w  w.j a va  2  s  .c  om
}

From source file:pl.test.face.facetest.FacebookDialogFragmentX.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (this.dialog == null) {
        final FragmentActivity activity = getActivity();
        Intent intent = activity.getIntent();
        Bundle params = NativeProtocol.getMethodArgumentsFromIntent(intent);

        boolean isWebFallback = params.getBoolean(NativeProtocol.WEB_DIALOG_IS_FALLBACK, false);
        WebDialog webDialog;// w  w w . j  a  v  a2  s .  c om
        if (!isWebFallback) {
            String actionName = params.getString(NativeProtocol.WEB_DIALOG_ACTION);
            Bundle webParams = params.getBundle(NativeProtocol.WEB_DIALOG_PARAMS);
            if (Utility.isNullOrEmpty(actionName)) {
                Utility.logd(TAG, "Cannot start a WebDialog with an empty/missing 'actionName'");
                activity.finish();
                return;
            }

            webDialog = new WebDialog.Builder(activity, actionName, webParams)
                    .setOnCompleteListener(new WebDialog.OnCompleteListener() {
                        @Override
                        public void onComplete(Bundle values, FacebookException error) {
                            onCompleteWebDialog(values, error);

                        }
                    }).build();
        } else {
            String url = params.getString(NativeProtocol.WEB_DIALOG_URL);
            if (Utility.isNullOrEmpty(url)) {
                Utility.logd(TAG, "Cannot start a fallback WebDialog with an empty/missing 'url'");
                activity.finish();
                return;
            }

            String redirectUrl = String.format("fb%s://bridge/", FacebookSdk.getApplicationId());
            webDialog = new FacebookWebFallbackDialog(activity, url, redirectUrl);
            webDialog.setOnCompleteListener(new WebDialog.OnCompleteListener() {
                @Override
                public void onComplete(Bundle values, FacebookException error) {
                    // Error data is nested in the values since this is in the form of a
                    // Native protocol response
                    onCompleteWebFallbackDialog(values);
                }
            });
        }

        this.dialog = webDialog;
    }
}

From source file:com.mattprecious.notisync.activity.WizardActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wizard);/*from w w  w  .j  ava 2 s  . c  o m*/

    mWizardModel = new WizardModel(this);

    if (savedInstanceState != null) {
        mWizardModel.load(savedInstanceState.getBundle("model"));
    }

    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;
            }

            updateBottomBar();
        }
    });

    mNextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mPager.getCurrentItem() == mCurrentPageSequence.size() - 1) {
                Preferences.setCompletedWizard(getApplicationContext(), true);
                setResult(RESULT_OK);
                finish();
            } 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:com.thesis.emostatus.TutorialActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tutorial);

    if (savedInstanceState != null) {
        mWizardModel.load(savedInstanceState.getBundle("model"));
    }//from  ww  w  .  j  a v  a 2s.c o m

    back = getIntent().getBooleanExtra("action_back", false);

    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);
    mSkipButton = (Button) findViewById(R.id.skip_button);

    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            mStepPagerStrip.setCurrentPage(position);

            if (mConsumePageSelectedEvent) {
                mConsumePageSelectedEvent = false;
                return;
            }

            mEditingAfterReview = false;
            updateBottomBar();
        }
    });

    mNextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mPager.getCurrentItem() == mCurrentPageSequence.size()) {
                goToUsersList();
            } 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);
        }
    });

    mSkipButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (back)
                onBackPressed();
            else
                goToUsersList();
        }
    });

    onPageTreeChanged();
    updateBottomBar();
}

From source file:de.vanita5.twittnuker.fragment.support.BaseSupportListFragment.java

@Override
public Bundle getExtraConfiguration() {
    final Bundle args = getArguments();
    final Bundle extras = new Bundle();
    if (args != null && args.containsKey(EXTRA_EXTRAS)) {
        extras.putAll(args.getBundle(EXTRA_EXTRAS));
    }/*from   www. j a v a  2  s  .  c  om*/
    return extras;
}

From source file:com.money.manager.ex.reports.PieChartFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mTextColor = new UIHelper(getActivity()).resolveAttribute(R.attr.chartTextColor);
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(KEY_SAVED_INSTANCE))
            setChartArguments(savedInstanceState.getBundle(KEY_SAVED_INSTANCE));
        if (savedInstanceState.containsKey(KEY_DISPLAY_AS_UP_ENABLED))
            setDisplayHomeAsUpEnabled(savedInstanceState.getBoolean(KEY_DISPLAY_AS_UP_ENABLED));
    }/*from   w ww . j  av a  2  s . co  m*/
    // enabled display as home
    //        ActionBarActivity activity = (ActionBarActivity) getActivity();
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    if (activity != null && activity.getSupportActionBar() != null) {
        activity.getSupportActionBar().setDisplayHomeAsUpEnabled(isDisplayHomeAsUpEnabled());
    }
    // set has option menu
    setHasOptionsMenu(true);
}

From source file:org.wahtod.wififixer.ui.AboutFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState == null) {
        /*//w w  w.  ja  va2s . c  o  m
         * Do nothing
         */
    } else {
        /*
         * Restore Network
         */
        mNetwork = WFScanResult.fromBundle(savedInstanceState.getBundle(NETWORK_KEY));
    }
    IntentFilter scan = new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
    BroadcastHelper.registerReceiver(getActivity(), scanreceiver, scan, false);
}

From source file:org.wahtod.wififixer.ui.ConnectFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState == null) {
        /*//from w  w  w.j a  va 2 s  .c  om
         * Do nothing
         */
    } else {
        /*
         * Restore Network
         */
        mNetwork = WFScanResult.fromBundle(savedInstanceState.getBundle(NETWORK_KEY));
    }
    Button b = (Button) getActivity().findViewById(R.id.connect);
    mPasswordHolder = new PasswordHolder();

    mPasswordHolder.password = getActivity().findViewById(R.id.password);
    TextView summary = (TextView) getActivity().findViewById(R.id.password_summary);
    if (StringUtil.getCapabilitiesString(mNetwork.capabilities).equals(StringUtil.OPEN)
            || KnownNetworksFragment.getNetworks(getActivity()).contains(mNetwork.SSID)) {
        mPasswordHolder.password.setVisibility(View.INVISIBLE);
        b.setText(getString(R.string.connect));
        summary.setText(R.string.button_connect);
    }
    b.setOnClickListener(this);
    TextView s = (TextView) getActivity().findViewById(R.id.network_name);
    if (mNetwork.SSID.length() > 0)
        s.setText(mNetwork.SSID);
    else
        s.setText(mNetwork.BSSID);
}