List of usage examples for android.os Bundle getBundle
@Nullable
public Bundle getBundle(@Nullable String key)
From source file:de.tudarmstadt.informatik.secuso.phishedu2.MainActivity.java
@Override protected void onCreate(Bundle b) { super.onCreate(b); clearFragCache();// w ww . jav a 2 s. c o m if (b != null) { this.current_frag = b.getString("current_frag"); Bundle fragcache_bundle = b.getBundle("fragCache"); Set<String> keyset = fragcache_bundle.keySet(); for (String key : keyset) { try { @SuppressWarnings("unchecked") Class<PhishBaseActivity> fragClass = (Class<PhishBaseActivity>) Class.forName(key); PhishBaseActivity newinstance = fragClass.newInstance(); Bundle current_bundle = fragcache_bundle.getBundle(key); newinstance.onCreate(current_bundle); addToFragCache(newinstance); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } setContentView(R.layout.main); if (!BackendControllerImpl.getInstance().isInitDone()) { BackendControllerImpl.getInstance().init(this, this); } BackendControllerImpl.getInstance().clearOnLevelChangeListener(); BackendControllerImpl.getInstance().clearOnLevelstateChangeListener(); BackendControllerImpl.getInstance().addOnLevelChangeListener(this); BackendControllerImpl.getInstance().addOnLevelstateChangeListener(this); clearFragCache(); showMainMenu(); BackendControllerImpl.getInstance().onUrlReceive(getIntent().getData()); }
From source file:apps.veery.com.util.PreferenceFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (mHavePrefs) { bindPreferences();// w w w . j av a 2 s. c om } mInitDone = true; if (savedInstanceState != null) { Bundle container = savedInstanceState.getBundle(PREFERENCES_TAG); if (container != null) { final PreferenceScreen preferenceScreen = getPreferenceScreen(); if (preferenceScreen != null) { preferenceScreen.restoreHierarchyState(container); } } } }
From source file:is.hello.go99.example.AmplitudesFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.amplitudeSource = new RandomAmplitudeSource(); if (savedInstanceState != null) { final Bundle savedState = savedInstanceState.getBundle(SAVED_SOURCE_STATE); if (savedState != null) { amplitudeSource.restoreState(savedState); }// ww w . j a va 2 s .c o m } }
From source file:com.limelight.testvideosdk.PreferenceFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (mHavePrefs) { bindPreferences();/* www .jav a 2 s .c om*/ } mInitDone = true; if (savedInstanceState != null) { Bundle container = savedInstanceState.getBundle(PREFERENCES_TAG); if (container != null) { final PreferenceScreen preferenceScreen = getPreferenceScreen(); if (preferenceScreen != null) { preferenceScreen.restoreHierarchyState(container); } } } }
From source file:com.sintef_energy.ubisolar.fragments.UsageFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mDevices = new LinkedHashMap<>(); if (savedInstanceState != null && mSavedState == null) mSavedState = savedInstanceState.getBundle("mSavedState"); LoaderManager loaderManager = getLoaderManager(); //Get devices if (mSavedState != null) { mDeviceUsageList = mSavedState.getParcelableArrayList("mDeviceUsageList"); loaderManager.restartLoader(LOADER_DEVICES, null, this); } else {//from ww w . j a v a 2s. c om mDeviceUsageList = new ArrayList<>(); loaderManager.initLoader(LOADER_DEVICES, null, this); } mPreferenceManager.setNavDrawerUsage(0); Intent i = new Intent(Global.BROADCAST_NAV_DRAWER); i.putExtra(Global.DATA_B_NAV_DRAWER_USAGE, 0); LocalBroadcastManager.getInstance(this.getActivity().getApplicationContext()).sendBroadcast(i); }
From source file:com.near.chimerarevo.activities.PostContainerActivity.java
@Override protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); args = savedInstanceState.getBundle("arguments"); if (args.containsKey("isLandscapeLarge")) isLandscapeLarge = args.getBoolean("isLandscapeLarge", false); }
From source file:org.gnucash.android.ui.wizard.FirstRunWizardActivity.java
/** * Create the wizard model for the activity, taking into accoun the savedInstanceState if it * exists (and if it contains a "model" key that we can use). * @param savedInstanceState the instance state available in {{@link #onCreate(Bundle)}} * @return an appropriate wizard model for this activity */// w w w. jav a 2s .c om private AbstractWizardModel createWizardModel(Bundle savedInstanceState) { AbstractWizardModel model = new FirstRunWizardModel(this); if (savedInstanceState != null) { Bundle wizardModel = savedInstanceState.getBundle("model"); if (wizardModel != null) { model.load(wizardModel); } } model.registerListener(this); return model; }
From source file:com.selcukcihan.android.namewizard.SetupActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_setup); mWizardModel = new SandwichWizardModel(this); if (savedInstanceState != null) { mWizardModel.load(savedInstanceState.getBundle("model")); }/*from ww 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(); } }); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mPager.getCurrentItem() == mCurrentPageSequence.size()) { Bundle bundle = mWizardModel.save(); UserData data = new UserData(bundle, SetupActivity.this); data.persist(PreferenceManager.getDefaultSharedPreferences(SetupActivity.this).edit()); 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:ca.rmen.android.scrumchatter.dialog.InputDialogFragment.java
@Override @NonNull/* w w w . ja v a 2 s. c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { Log.v(TAG, "onCreateDialog: savedInstanceState = " + savedInstanceState); if (savedInstanceState != null) mEnteredText = savedInstanceState.getString(DialogFragmentFactory.EXTRA_ENTERED_TEXT); Bundle arguments = getArguments(); final int actionId = arguments.getInt(DialogFragmentFactory.EXTRA_ACTION_ID); final InputDialogEditTextBinding binding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.input_dialog_edit_text, null, false); final Bundle extras = arguments.getBundle(DialogFragmentFactory.EXTRA_EXTRAS); final Class<?> inputValidatorClass = (Class<?>) arguments .getSerializable(DialogFragmentFactory.EXTRA_INPUT_VALIDATOR_CLASS); final String prefilledText = arguments.getString(DialogFragmentFactory.EXTRA_ENTERED_TEXT); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(arguments.getString(DialogFragmentFactory.EXTRA_TITLE)); builder.setView(binding.getRoot()); binding.edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS); binding.edit.setHint(arguments.getString(DialogFragmentFactory.EXTRA_INPUT_HINT)); binding.edit.setText(prefilledText); if (!TextUtils.isEmpty(mEnteredText)) binding.edit.setText(mEnteredText); // Notify the activity of the click on the OK button. OnClickListener listener = null; if ((getActivity() instanceof DialogInputListener)) { listener = (dialog, which) -> { FragmentActivity activity = getActivity(); if (activity == null) Log.w(TAG, "User clicked on dialog after it was detached from activity. Monkey?"); else ((DialogInputListener) activity).onInputEntered(actionId, binding.edit.getText().toString(), extras); }; } builder.setNegativeButton(android.R.string.cancel, null); builder.setPositiveButton(android.R.string.ok, listener); final AlertDialog dialog = builder.create(); // Show the keyboard when the EditText gains focus. binding.edit.setOnFocusChangeListener((v, hasFocus) -> { if (hasFocus) { Window window = dialog.getWindow(); if (window != null) { window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } }); final Context context = getActivity(); try { final InputValidator validator = inputValidatorClass == null ? null : (InputValidator) inputValidatorClass.newInstance(); Log.v(TAG, "input validator = " + validator); // Validate the text as the user types. binding.edit.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { mEnteredText = binding.edit.getText().toString(); if (validator != null) validateText(context, dialog, binding.edit, validator, actionId, extras); } }); dialog.setOnShowListener(dialogInterface -> { Log.v(TAG, "onShow"); validateText(context, dialog, binding.edit, validator, actionId, extras); }); } catch (Exception e) { Log.e(TAG, "Could not instantiate validator " + inputValidatorClass + ": " + e.getMessage(), e); } return dialog; }
From source file:com.ute.bihapi.wydarzeniatekstowe.thirdScreenActivities.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { /*if (BuildConfig.DEBUG) { Utils.enableStrictMode();//from ww w .j a v a 2s.c om }*/ super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.activity_contacts_main); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } memory = new Bundle(); if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if (extras != null) { for (String layoutElement : layoutElements) { if (extras.get(layoutElement) != null) { if (layoutElement.equals("Person")) { Bundle mp = null; mp = extras.getBundle("Person"); Log.i("Memory", "Got entry from previous activity: " + mp.keySet().toArray()[0].toString() + " " + mp.get(mp.keySet().toArray()[0].toString()).toString()); memory.putBundle("Person", mp); } else if (layoutElement.equals("Point")) { Bundle mp = null; mp = extras.getBundle("Point"); Log.i("Memory", "Got entry from previous activity: " + mp.keySet().toArray()[0].toString() + " " + mp.get(mp.keySet().toArray()[0].toString()).toString()); memory.putBundle("Point", mp); } else { memory.putString(layoutElement, extras.get(layoutElement).toString()); Log.i("Memory", "Got entry from prevoius activity: " + layoutElement + ": " + extras.get(layoutElement).toString()); } } } } } }