List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:github.popeen.dsub.fragments.SelectDirectoryFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { Bundle args = getArguments(); if (args != null) { id = args.getString(Constants.INTENT_EXTRA_NAME_ID); name = args.getString(Constants.INTENT_EXTRA_NAME_NAME); directory = (Entry) args.getSerializable(Constants.INTENT_EXTRA_NAME_DIRECTORY); playlistId = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID); playlistName = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME); playlistOwner = args.getBoolean(Constants.INTENT_EXTRA_NAME_PLAYLIST_OWNER, false); podcastId = args.getString(Constants.INTENT_EXTRA_NAME_PODCAST_ID); podcastName = args.getString(Constants.INTENT_EXTRA_NAME_PODCAST_NAME); podcastDescription = args.getString(Constants.INTENT_EXTRA_NAME_PODCAST_DESCRIPTION); Object shareObj = args.getSerializable(Constants.INTENT_EXTRA_NAME_SHARE); share = (shareObj != null) ? (Share) shareObj : null; albumListType = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE); albumListExtra = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_EXTRA); albumListSize = args.getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0); refreshListing = args.getBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS); artist = args.getBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, false); lookupEntry = args.getString(Constants.INTENT_EXTRA_SEARCH_SONG); topTracks = args.getBoolean(Constants.INTENT_EXTRA_TOP_TRACKS); showAll = args.getBoolean(Constants.INTENT_EXTRA_SHOW_ALL); String childId = args.getString(Constants.INTENT_EXTRA_NAME_CHILD_ID); if (childId != null) { id = childId;//from w ww.j a v a 2s . c o m lookupParent = true; } if (entries == null) { entries = (List<Entry>) args.getSerializable(Constants.FRAGMENT_LIST); albums = (List<Entry>) args.getSerializable(Constants.FRAGMENT_LIST2); if (albums == null) { albums = new ArrayList<Entry>(); } } } rootView = inflater.inflate(R.layout.abstract_recycler_fragment, container, false); refreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_layout); refreshLayout.setOnRefreshListener(this); if (Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_LARGE_ALBUM_ART, true)) { largeAlbums = true; } recyclerView = (RecyclerView) rootView.findViewById(R.id.fragment_recycler); recyclerView.setHasFixedSize(true); fastScroller = (FastScroller) rootView.findViewById(R.id.fragment_fast_scroller); setupScrollList(recyclerView); setupLayoutManager(recyclerView, largeAlbums); if (entries == null) { if (primaryFragment || secondaryFragment) { load(false); } else { invalidated = true; } } else { licenseValid = true; finishLoading(); } if (name != null) { setTitle(name); } return rootView; }
From source file:com.ebridgevas.android.ebridgeapp.messaging.mqttservice.MqttAndroidClient.java
/** * Common processing for many notifications * //from www.ja v a 2s.c o m * @param token * the token associated with the action being undertake * @param data * the result data */ private void simpleAction(IMqttToken token, Bundle data) { if (token != null) { Status status = (Status) data.getSerializable(MqttServiceConstants.CALLBACK_STATUS); if (status == Status.OK) { ((MqttTokenAndroid) token).notifyComplete(); } else { Exception exceptionThrown = (Exception) data .getSerializable(MqttServiceConstants.CALLBACK_EXCEPTION); ((MqttTokenAndroid) token).notifyFailure(exceptionThrown); } } else { mqttService.traceError(MqttService.TAG, "simpleAction : token is null"); } }
From source file:com.ebridgevas.android.ebridgeapp.messaging.mqttservice.MqttAndroidClient.java
/** * Process a Connection Lost notification * //from w w w .j ava 2 s. co m * @param data */ private void connectionLostAction(Bundle data) { if (callback != null) { Exception reason = (Exception) data.getSerializable(MqttServiceConstants.CALLBACK_EXCEPTION); callback.connectionLost(reason); } }
From source file:com.hackensack.umc.activity.RegistrationDetailsActivity.java
private void getIntentData(Intent intent) { Bundle bundle = intent.getBundleExtra(Constant.BUNDLE); regMode = bundle.getInt(Constant.REGISTRATION_MODE, 0); if (regMode == Constant.AUTO) { DataForAutoRegistration dataForAutoRegistration = (DataForAutoRegistration) bundle .getSerializable(Constant.REG_REQUIRED_DATA); Log.v(TAG, dataForAutoRegistration.toString()); pathSelfie = bundle.getString(Constant.KEY_SLFIE); pathIdFront = bundle.getString(Constant.KEY_ID_FRONT); try {/* ww w. ja v a 2s . c o m*/ pathIdBack = bundle.getString(Constant.KEY_ID_BACK); pathIcFront = bundle.getString(Constant.KEY_INSURANCE_FRONT); pathIcBack = bundle.getString(Constant.KEY_INSURANCE_BACK); } catch (Exception e) { } setDataToField(dataForAutoRegistration); } //proceedAccordingToActivityMode(regMode); }
From source file:com.appdynamics.demo.gasp.activity.LocationsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Instrumentation.start("EUM-AAB-AUB", getApplicationContext(), "http://ec2-54-214-82-33.us-west-2.compute.amazonaws.com", true); mGaspRegistrationClient.registerGCM(this); TwitterAuthentication.requestTwitterOAuthToken(this); LocationServices.enableLocationChecking(this); mLocation = LocationServices.getLocation(this); // Activity first created if (savedInstanceState == null) { // We need Play Services and Network connectivity if (PlayServices.checkPlayServices(this) && Network.checkNetworking(this)) { // Register listener for notification that restaurant data has been synced LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter(SYNC_COMPLETED)); // Start data sync services and draw map startDataSyncServices();/*from w w w . ja va2 s .c o m*/ prepareMapView(); } else { Log.e(TAG, "Cannot launch LocationsActivity"); finish(); } } // Subsequent onCreate() events else { // Restore incremental search results, page_token and zoom level mSearchResult = (SearchResult) savedInstanceState.getSerializable(SEARCH_RESULT); mPageToken = savedInstanceState.getString(PAGE_TOKEN); mZoom = savedInstanceState.getFloat(ZOOM_LEVEL); // Display locations and enable/disable "More Locations" button prepareMapView(); showLocations(mSearchResult); if (!mPageToken.isEmpty()) { setPlacesButton(true); } } }
From source file:com.kncwallet.wallet.ui.SendCoinsFragment.java
private void restoreInstanceState(final Bundle savedInstanceState) { state = (State) savedInstanceState.getSerializable("state"); validatedAddress = savedInstanceState.getParcelable("validated_address"); isValidAmounts = savedInstanceState.getBoolean("is_valid_amounts"); if (savedInstanceState.containsKey("sent_transaction_hash")) { sentTransaction = wallet//w w w. j av a 2s . com .getTransaction((Sha256Hash) savedInstanceState.getSerializable("sent_transaction_hash")); sentTransaction.getConfidence().addEventListener(sentTransactionConfidenceListener); } bluetoothMac = savedInstanceState.getString("bluetooth_mac"); if (savedInstanceState.containsKey("bluetooth_ack")) bluetoothAck = savedInstanceState.getBoolean("bluetooth_ack"); }
From source file:com.fjn.magazinereturncandidate.activities.SdmScannerActivity.java
/** * Initialize screen layout/*from w w w . j a v a 2 s . com*/ * * @param state {@link Bundle} */ @Override public void onCreate(Bundle state) { LogManagerCommon.i(TAG, Message.TAG_SCANNER_ACTIVITY + Message.MESSAGE_ACTIVITY_START); super.onCreate(state); setContentView(R.layout.activity_sdm_scanner); returnMagazineModel = new ReturnMagazineModel(); csvFileCommon = new CSVFileCommon(); registerLicenseCommon = new RegisterLicenseCommon(); maxYearRank = new MaxYearRankEntity(); checkDataCommon = new CheckDataCommon(); formatCommon = new FormatCommon(); strBarcodeOld = ""; // Load user info Bundle bundle = getIntent().getExtras(); if (bundle != null) { //get flag switch OCR flagSwitchOCR = bundle.getString(Constants.FLAG_SWITCH_OCR); userID = bundle.getString(Constants.COLUMN_USER_ID); shopID = bundle.getString(Constants.COLUMN_SHOP_ID); serverName = bundle.getString(Constants.COLUMN_SERVER_NAME); license = bundle.getString(Constants.COLUMN_LICENSE); hashMapArrBook = (HashMap<String, LinkedList<String[]>>) bundle .getSerializable(Constants.COLUMN_INFOR_LIST_SCAN); } // UI init UsersEntity user = new UserModel().getUserInfo(); TextView tvUserName = (TextView) findViewById(R.id.txv_user_name); tvUserName.setText(user.getName()); lvBook = (ListView) findViewById(R.id.list_book); arrBookInlist = new LinkedList<>(); if (hashMapArrBook != null) { arrBookInlist = new LinkedList<>(hashMapArrBook.get(Constants.COLUMN_INFOR_LIST_SCAN)); } //Check OCR null if (flagSwitchOCR == null) { //Flag disable OCR (default) flagSwitchOCR = Constants.FLAG_0; } MaxYearRankModel maxYearRankModel = new MaxYearRankModel(); DatabaseManagerCommon.initializeInstance(new DatabaseHelper(getApplicationContext())); maxYearRank = maxYearRankModel.getMaxYearRank(); // Init process loading screen progress = new ProgressDialog(this); progress.setMessage(Message.MESSAGE_UPLOAD_LOG_SCREEN); progress.setCancelable(false); // Activate HSM license ActivationResult activationResult = ActivationManager.activate(this, license); Toast.makeText(this, "Activation result: " + activationResult, Toast.LENGTH_LONG).show(); // HSM init hsmDecoder = HSMDecoder.getInstance(this); // Declare symbology hsmDecoder.enableSymbology(Symbology.EAN13); hsmDecoder.enableSymbology(Symbology.EAN13_5CHAR_ADDENDA); hsmDecoder.enableSymbology(Symbology.CODE128); //hsmDecoder.enableSymbology(Symbology.OCR); //hsmDecoder.setOCRActiveTemplate(OCRActiveTemplate.ISBN); //create plug-in instance and add a result listener customPlugin = new MyCustomPlugin(getApplicationContext(), 100); customPlugin.addResultListener(this); //register the plug-in with the system hsmDecoder.registerPlugin(customPlugin); // Declare HSM component UI hsmDecoder.enableFlashOnDecode(false); hsmDecoder.enableSound(false); hsmDecoder.enableAimer(false); hsmDecoder.setWindowMode(WindowMode.CENTERING); hsmDecoder.setWindow(18, 42, 0, 100); // Assign listener //hsmDecoder.addResultListener(this); // Sound init normalSound = MediaPlayer.create(this, R.raw.pingpong_main); // sound is inside res/raw/mysound //totalTimeNormalAudio = normalSound.getDuration(); noReturnSound = MediaPlayer.create(this, R.raw.wrong_main); // sound is inside res/raw/mysound //totalTimeNoReturnAudio = noReturnSound.getDuration(); // Button init btnLogout = (Button) findViewById(R.id.btn_logout); btnInputJan = (Button) findViewById(R.id.btn_input_jancode); btnSend = (Button) findViewById(R.id.btn_send_data); aSwitchOCR = (Switch) findViewById(R.id.switch_OCR); btnLogout.setOnClickListener(this); btnSend.setOnClickListener(this); btnInputJan.setOnClickListener(this); /* aSwitchOCR.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (aSwitchOCR.isChecked()) { flagSwitchOCR = registerLicenseCommon.EnableOCRDisableJanCode(hsmDecoder); } else { flagSwitchOCR = registerLicenseCommon.EnableJanCodeDisableOCR(hsmDecoder); } } });*/ //Check if arr list books not null if (arrBookInlist != null) { // Set data adapter to list view ListViewScanAdapter adapterBook = new ListViewScanAdapter(this, arrBookInlist); lvBook.setAdapter(adapterBook); } //Check network send file and check csvFileCommon.isExistFileCSV() if (csvFileCommon.isExistFileCSV() != 0) { //Disable scan registerLicenseCommon.DisableScan(hsmDecoder); //Show dialog choose send data showDialogNotifyListCSVWhenLogin(); } }
From source file:dev.memento.MementoBrowser.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); Log.d(LOG_TAG, "-- onRestoreInstanceState"); mOriginalUrl = savedInstanceState.getString("mOriginalUrl"); mPageTitle = savedInstanceState.getString("mPageTitle"); mMementos = (MementoList) savedInstanceState.getSerializable("mMementos"); Log.d(LOG_TAG, "** Num of mementos: " + mMementos.size()); if (mMementos != null) { mFirstMemento = mMementos.getFirst(); mLastMemento = mMementos.getLast(); }// ww w . ja v a2s. co m // Only enable buttons if viewing Mementos if (!mToday.equalsDate(mDateChosen)) setEnableForNextPrevButtons(); }
From source file:cn.edu.zafu.corepage.base.BaseActivity.java
/** * ???// w ww . j av a2s . c om * * @param savedInstanceState Bundle */ private void loadActivitySavedData(Bundle savedInstanceState) { Field[] fields = this.getClass().getDeclaredFields(); Field.setAccessible(fields, true); Annotation[] ans; for (Field f : fields) { ans = f.getDeclaredAnnotations(); for (Annotation an : ans) { if (an instanceof SaveWithActivity) { try { String fieldName = f.getName(); @SuppressWarnings("rawtypes") Class cls = f.getType(); if (cls == int.class || cls == Integer.class) { f.setInt(this, savedInstanceState.getInt(fieldName)); } else if (String.class.isAssignableFrom(cls)) { f.set(this, savedInstanceState.getString(fieldName)); } else if (Serializable.class.isAssignableFrom(cls)) { f.set(this, savedInstanceState.getSerializable(fieldName)); } else if (cls == long.class || cls == Long.class) { f.setLong(this, savedInstanceState.getLong(fieldName)); } else if (cls == short.class || cls == Short.class) { f.setShort(this, savedInstanceState.getShort(fieldName)); } else if (cls == boolean.class || cls == Boolean.class) { f.setBoolean(this, savedInstanceState.getBoolean(fieldName)); } else if (cls == byte.class || cls == Byte.class) { f.setByte(this, savedInstanceState.getByte(fieldName)); } else if (cls == char.class || cls == Character.class) { f.setChar(this, savedInstanceState.getChar(fieldName)); } else if (CharSequence.class.isAssignableFrom(cls)) { f.set(this, savedInstanceState.getCharSequence(fieldName)); } else if (cls == float.class || cls == Float.class) { f.setFloat(this, savedInstanceState.getFloat(fieldName)); } else if (cls == double.class || cls == Double.class) { f.setDouble(this, savedInstanceState.getDouble(fieldName)); } else if (String[].class.isAssignableFrom(cls)) { f.set(this, savedInstanceState.getStringArray(fieldName)); } else if (Parcelable.class.isAssignableFrom(cls)) { f.set(this, savedInstanceState.getParcelable(fieldName)); } else if (Bundle.class.isAssignableFrom(cls)) { f.set(this, savedInstanceState.getBundle(fieldName)); } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } } }
From source file:com.mbientlab.metawear.app.ModuleActivity.java
@SuppressWarnings("unchecked") @Override/*w ww . j a v a 2 s. c o m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); if (!bluetoothManager.getAdapter().isEnabled()) { final Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableIntent, REQUEST_ENABLE_BT); } getApplicationContext().bindService(new Intent(this, MetaWearBleService.class), this, Context.BIND_AUTO_CREATE); if (savedInstanceState != null) { device = (BluetoothDevice) savedInstanceState.getParcelable(EXTRA_BLE_DEVICE); moduleFragment = (ModuleFragment) getSupportFragmentManager().getFragment(savedInstanceState, "mContent"); tapType = savedInstanceState.getInt(Extra.TAP_TYPE); tapAxis = savedInstanceState.getInt(Extra.TAP_AXIS); shakeAxis = savedInstanceState.getInt(Extra.SHAKE_AXIS); dataRange = savedInstanceState.getInt(Extra.DATA_RANGE); samplingRate = savedInstanceState.getInt(Extra.SAMPLING_RATE); ffMovement = savedInstanceState.getBoolean(Extra.FF_MOVEMENT); newFirmware = savedInstanceState.getBoolean(Extra.NEW_FIRMWARE); samplingConfigBytes = savedInstanceState.getByteArray(Extra.SAMPLING_CONFIG_BYTES); polledData = (ArrayList<byte[]>) savedInstanceState.getSerializable(Extra.POLLED_DATA); } }