List of usage examples for android.os Bundle getBundle
@Nullable
public Bundle getBundle(@Nullable String key)
From source file:com.btmura.android.reddit.app.CommentListController.java
@Override public void restoreInstanceState(Bundle savedInstanceState) { int defFilter = AccountPrefs.getLastCommentFilter(context, Filter.COMMENTS_BEST); this.filter = savedInstanceState.getInt(EXTRA_FILTER, defFilter); this.cursorExtras = savedInstanceState.getBundle(EXTRA_CURSOR_EXTRAS); }
From source file:org.jboss.aerogear.android.authentication.impl.loader.support.SupportAuthenticationModuleAdapter.java
@Override public Loader<HeaderAndBody> onCreateLoader(int id, Bundle bundle) { SupportAuthenticationModuleAdapter.Methods method = (SupportAuthenticationModuleAdapter.Methods) bundle .get(METHOD);/*from ww w .jav a 2s .c o m*/ Callback callback = (Callback) bundle.get(CALLBACK); Loader loader = null; switch (method) { case LOGIN: { Bundle loginBundle = bundle.getBundle(PARAMS); Map<String, String> loginParams = new HashMap<String, String>(loginBundle.size()); for (String key : loginBundle.keySet()) { loginParams.put(key, loginBundle.getString(key)); } loader = new SupportLoginLoader(applicationContext, callback, module, loginParams); } break; case LOGOUT: { loader = new SupportLogoutLoader(applicationContext, callback, module); } break; case ENROLL: { Map<String, String> params = (Map<String, String>) bundle.getSerializable(PARAMS); loader = new SupportEnrollLoader(applicationContext, callback, module, params); } break; } return loader; }
From source file:com.javielinux.tweettopics2.UserActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); themeManager = new ThemeManager(this); themeManager.setTranslucentTheme();//from w w w . j av a 2 s . c o m Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(Utils.KEY_EXTRAS_INFO)) { //extras.getString(KEY_EXTRAS_USER).replace("@", ""); username = extras.getBundle(Utils.KEY_EXTRAS_INFO).getString(KEY_EXTRAS_USER).replace("@", ""); } } if (username == null) { Utils.showMessage(UserActivity.this, UserActivity.this.getString(R.string.no_server)); finish(); } infoUser = CacheData.getInstance().getCacheUser(username); setContentView(R.layout.user_activity); viewLoading = (LinearLayout) findViewById(R.id.user_view_loading); viewInfo = (RelativeLayout) findViewById(R.id.user_view_info); imgAvatar = ((ImageView) findViewById(R.id.user_avatar)); imgAvatar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO abrir imagen en grande } }); llRoot = (RelativeLayout) findViewById(R.id.user_ll); txtFullName = ((TextView) findViewById(R.id.user_fullname)); txtUsername = ((TextView) findViewById(R.id.user_username)); txtText = ((TextView) findViewById(R.id.user_text)); (findViewById(R.id.user_btn_reply)).setOnClickListener(clickMention); (findViewById(R.id.user_btn_web)).setOnClickListener(clickWeb); (findViewById(R.id.user_btn_highlight)).setOnClickListener(clickHighlight); (findViewById(R.id.user_btn_more)).setOnClickListener(clickMore); pager = (ViewPager) findViewById(R.id.user_pager); indicator = (TabPageIndicator) findViewById(R.id.user_indicator); if (infoUser != null) { populateFields(); } else { showLoading(); APITweetTopics.execute(this, getSupportLoaderManager(), new APIDelegate<LoadUserResponse>() { @Override public void onResults(LoadUserResponse result) { infoUser = result.getInfoUsers(); hideLoading(); populateFields(); } @Override public void onError(ErrorResponse error) { Utils.showMessage(UserActivity.this, UserActivity.this.getString(R.string.no_server)); finish(); } }, new LoadUserRequest(username)); } ViewGroup root = (ViewGroup) findViewById(R.id.user_root); popupLinks = new PopupLinks(this); popupLinks.loadPopup(root); splitActionBarMenu = new SplitActionBarMenu(this); splitActionBarMenu.loadSplitActionBarMenu(root); refreshTheme(); }
From source file:androidx.navigation.fragment.NavHostFragment.java
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Context context = requireContext(); mNavController = new NavController(context); mNavController.getNavigatorProvider().addNavigator(createFragmentNavigator()); Bundle navState = null;// www . ja va2s . co m if (savedInstanceState != null) { navState = savedInstanceState.getBundle(KEY_NAV_CONTROLLER_STATE); if (savedInstanceState.getBoolean(KEY_DEFAULT_NAV_HOST, false)) { mDefaultNavHost = true; requireFragmentManager().beginTransaction().setPrimaryNavigationFragment(this).commit(); } } if (navState != null) { // Navigation controller state overrides arguments mNavController.restoreState(navState); } else { final Bundle args = getArguments(); final int graphId = args != null ? args.getInt(KEY_GRAPH_ID) : 0; if (graphId != 0) { mNavController.setGraph(graphId); } else { mNavController.setMetadataGraph(); } } }
From source file:com.brookmanholmes.bma.ui.newmatchwizard.CreateNewMatchActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_new_match); analytics.logEvent("create_match", null); wizardModel = new CreateNewMatchWizardModel(this); ButterKnife.bind(this); if (savedInstanceState != null) { wizardModel.load(savedInstanceState.getBundle("model")); }//from w w w. j a v a 2 s. c om wizardModel.registerListener(this); pagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(pagerAdapter); pagerStrip.setOnPageSelectedListener(new StepPagerStrip.OnPageSelectedListener() { @Override public void onPageStripSelected(int position) { position = Math.min(pagerAdapter.getCount() - 1, position); if (pager.getCurrentItem() != position) pager.setCurrentItem(position); } }); pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { pagerStrip.setCurrentPage(position); if (consumePageSelectedEvent) { consumePageSelectedEvent = false; return; } editingAfterReview = false; updateBottomBar(); } }); onPageTreeChanged(); updateBottomBar(); }
From source file:com.amazon.android.contentbrowser.helper.AuthHelper.java
/** * Handle error bundle./* ww w . j a v a 2s . c om*/ * TODO: Devtech 2447: Utilize logout method implemented above. * * @param extras Extras bundle. */ public void handleErrorBundle(Bundle extras) { Bundle bundle = extras.getBundle(AuthenticationConstants.ERROR_BUNDLE); Activity activity = mContentBrowser.getNavigator().getActiveActivity(); Log.d(TAG, "handleErrorBundle called" + activity.getLocalClassName()); ErrorHelper.injectErrorFragment(activity, convertAuthErrorToErrorUtils(bundle), (fragment, errorButtonType, errorCategory) -> { if (ErrorUtils.ERROR_BUTTON_TYPE.DISMISS == errorButtonType) { fragment.dismiss(); } else if (ErrorUtils.ERROR_BUTTON_TYPE.LOGOUT == errorButtonType) { mIAuthentication.logout(activity, new IAuthentication.ResponseHandler() { @Override public void onSuccess(Bundle extras) { broadcastAuthenticationStatus(false); fragment.dismiss(); } @Override public void onFailure(Bundle extras) { fragment.getArguments().putString(ErrorDialogFragment.ARG_ERROR_MESSAGE, activity.getResources().getString(R.string.logout_failure_message)); } }); } }); }
From source file:com.hamsik2046.password.view.SingleInputFormActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_single_input_form); loadTheme();//w w w. j av a 2s.c o m sSteps = getSteps(this); findViews(); if (savedInstanceState != null) { setupData = savedInstanceState.getBundle(KEY_DATA); mStepIndex = savedInstanceState.getInt(KEY_STEP_INDEX, 0); } setupTitle(); setupInput(); setupError(); setupDetails(); mNextButton.setOnClickListener(mOnNextButtonClickListener); mErrorSwitcher.setText(""); updateStep(); }
From source file:com.example.etsmith.gcmupstream.MyGcmListenerService.java
@Override public void onMessageReceived(String from, final Bundle data) { super.onMessageReceived(from, data); Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { public void run() { Toast.makeText(getApplicationContext(), "Message Received: " + data.toString(), Toast.LENGTH_SHORT) .show();//w w w.ja v a 2s . c o m } }); for (String dataTag : data.keySet()) { if (!dataTag.equals(Constants.NOTIFICATION_BUNDLE)) { Log.d(TAG, dataTag + ": " + data.getString(dataTag)); } else { Bundle bundle = data.getBundle(dataTag); for (String bundleTag : bundle.keySet()) { Log.d(TAG, bundleTag + ": " + data.getString(bundleTag)); } } } String action = data.getString(Constants.ACTION); String status = data.getString(Constants.STATUS); if (Constants.REGISTER_NEW_CLIENT.equals(action) && Constants.STATUS_REGISTERED.equals(status)) { Log.d(TAG, "Registration Success"); } else if (Constants.UNREGISTER_CLIENT.equals(action) && Constants.STATUS_UNREGISTERED.equals(status)) { // token = ""; Log.d(TAG, "Unregistration Success"); } else if (from.startsWith(Constants.TOPIC_ROOT)) { Log.d(TAG, "Topic message: " + data.toString()); } else { Log.d(TAG, "Other type of action: " + data.toString()); } }
From source file:fr.cobaltians.cobalt.activities.CobaltActivity.java
/************************************************************************************************************************ * LIFECYCLE/*from w w w .j a va 2s . c o m*/ ************************************************************************************************************************/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getLayoutToInflate()); sActivitiesArrayList.add(this); Bundle bundle = getIntent().getExtras(); Bundle extras = (bundle != null) ? bundle.getBundle(Cobalt.kExtras) : null; // TODO: uncomment for Bars /* if (extras != null && extras.containsKey(Cobalt.kBars)) { try { JSONObject actionBar = new JSONObject(extras.getString(Cobalt.kBars)); setupActionBar(actionBar); } catch (JSONException exception) { if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - onCreate: action bar configuration parsing failed. " + extras.getString(Cobalt.kBars)); exception.printStackTrace(); } } */ if (savedInstanceState == null) { CobaltFragment fragment = getFragment(); if (fragment != null) { if (bundle != null) { if (extras != null) fragment.setArguments(extras); mAnimatedTransition = bundle.getBoolean(Cobalt.kJSAnimated, true); if (mAnimatedTransition) { mWasPushedAsModal = bundle.getBoolean(Cobalt.kPushAsModal, false); if (mWasPushedAsModal) { sWasPushedFromModal = true; overridePendingTransition(R.anim.modal_open_enter, android.R.anim.fade_out); } else if (bundle.getBoolean(Cobalt.kPopAsModal, false)) { sWasPushedFromModal = false; overridePendingTransition(android.R.anim.fade_in, R.anim.modal_close_exit); } else if (sWasPushedFromModal) overridePendingTransition(R.anim.modal_push_enter, R.anim.modal_push_exit); } else overridePendingTransition(0, 0); } if (findViewById(getFragmentContainerId()) != null) { getSupportFragmentManager().beginTransaction().replace(getFragmentContainerId(), fragment) .commit(); } else if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - onCreate: fragment container not found"); } else if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - onCreate: getFragment() returned null"); } }
From source file:eu.codeplumbers.cosi.activities.FirstRunActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_firstrun); mWizardModel = new FirstRunWizardModel(FirstRunActivity.this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from w ww.j av a 2 s . co m*/ 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; } mEditingAfterReview = false; updateBottomBar(); } }); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mPager.getCurrentItem() == mCurrentPageSequence.size()) { Intent intent = new Intent(FirstRunActivity.this, CozyActivity.class); startActivity(intent); 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(); }