List of usage examples for android.os Bundle putSerializable
@Override public void putSerializable(@Nullable String key, @Nullable Serializable value)
From source file:com.tweetlanes.android.core.view.TweetFeedFragment.java
public static TweetFeedFragment newInstance(int laneIndex, final TwitterContentHandleBase handleBase, final String screenName, final String laneIdentifier, final String currentAccountKey) { TweetFeedFragment fragment = new TweetFeedFragment(); fragment.mContentHandle = TwitterManager.get().getContentHandle(handleBase, screenName, laneIdentifier, currentAccountKey);//from w ww . j a va 2 s.c o m fragment.configureBaseLaneFragment(laneIndex, fragment.mContentHandle.getTypeAsString(), new ConfigureBundleListener() { @Override public void addValues(Bundle args) { // TODO: serializing is a slow way of doing this... args.putSerializable(KEY_HANDLE_BASE, handleBase); args.putString(KEY_SCREEN_NAME, screenName); args.putString(KEY_LANE_IDENTIFIER, laneIdentifier); } }); return fragment; }
From source file:com.example.innf.newchangtu.Map.view.activity.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); savedInstanceState.putSerializable(KEY_TRACK, mTrack); savedInstanceState.putString(KEY_START_POSITION, mStartPosition); savedInstanceState.putString(KEY_END_POSITION, mEndPosition); savedInstanceState.putInt(KEY_TIME_INTERVAL, mTimeInterval); savedInstanceState.putString(KEY_PHONE, mPhone); Log.i(TAG, "onRestoreInstanceState: is called"); // savedInstanceState.putParcelableArrayList(KEY_POSITION_LIST, mPositionList); }
From source file:com.mbientlab.metawear.app.ModuleActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (device != null) { outState.putParcelable(EXTRA_BLE_DEVICE, device); }//from w w w .ja v a 2 s.c o m if (moduleFragment != null) { getSupportFragmentManager().putFragment(outState, "mContent", moduleFragment); } outState.putInt(Extra.TAP_TYPE, tapType); outState.putInt(Extra.TAP_AXIS, tapAxis); outState.putInt(Extra.SHAKE_AXIS, shakeAxis); outState.putInt(Extra.DATA_RANGE, dataRange); outState.putInt(Extra.SAMPLING_RATE, samplingRate); outState.putBoolean(Extra.FF_MOVEMENT, ffMovement); outState.putBoolean(Extra.NEW_FIRMWARE, newFirmware); outState.putByteArray(Extra.SAMPLING_CONFIG_BYTES, samplingConfigBytes); outState.putSerializable(Extra.POLLED_DATA, polledData); }
From source file:at.jclehner.rxdroid.DrugListActivity.java
@SuppressWarnings("deprecation") private void showDoseDialog(Drug drug, Date date, int doseTime, boolean forceShow) { if (toastIfPastMaxHistoryAge(date)) return;//from ww w . java2 s . co m else if (!date.equals(mCurrentDate)) { Log.i(TAG, "DoseView date " + DateTime.toDateString(date) + " differs from Activity date " + DateTime.toDateString(mCurrentDate) + " "); invalidateViewPager(); date = mCurrentDate; if (BuildConfig.DEBUG) Toast.makeText(this, "Invoked workaround!", Toast.LENGTH_SHORT).show(); } final Bundle args = new Bundle(); args.putInt(DoseDialog.ARG_DRUG_ID, drug.getId()); args.putInt(DoseDialog.ARG_DOSE_TIME, doseTime); args.putSerializable(DoseDialog.ARG_DATE, date); args.putBoolean(DoseDialog.ARG_FORCE_SHOW, forceShow); showDialog(R.id.dose_dialog, args); }
From source file:ch.bfh.evoting.alljoyn.BusHandler.java
/** * Send a message to the given group/*www .j a v a2 s. c o m*/ * @param groupName group to send the message to * @param message message to send * @param encrypted indicate if message must be encrypted or not * @param type type of the content in the message */ private void doPing(String groupName, String message, boolean encrypted, Type type) { //if messageEncrypter is not ready or group joining is not terminated, we enqueue the message if ((!messageEncrypter.isReady() && encrypted) || !connected) { Message msg = this.obtainMessage(BusHandler.PING); Bundle data = new Bundle(); data.putString("groupName", groupName); data.putString("pingString", message); data.putBoolean("encrypted", encrypted); data.putSerializable("type", type); msg.setData(data); this.sendMessage(msg); Log.d(TAG, "Queueing message to send " + message); return; } //Create the message object with the received parameter AllJoynMessage messageObject = new AllJoynMessage(this.messageEncrypter, this.messageAuthenticater); if (type == null) type = Type.NORMAL; messageObject.setType(type); messageObject.setSender(this.getIdentification()); boolean messageEncrypted = messageObject.setMessage(message, encrypted); if (!messageEncrypted) { Log.e(TAG, "Message encryption failed"); return; } boolean messageSigned = messageObject.signMessage(); if (!messageSigned) { Log.e(TAG, "Signature failed"); return; } //Serialize the message messageObject.setMessageAuthenticater(null); messageObject.setMessageEncrypter(null); String toSend = su.serialize(messageObject); try { Log.d(TAG, "sending message of size " + toSend.getBytes("UTF-8").length + " bytes. Maximum allowed by AllJoyn is 128Kb."); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } //Send the message SimpleInterface simpleInterface = mGroupManager.getSignalInterface(groupName, mSimpleService, SimpleInterface.class); try { if (simpleInterface != null) { simpleInterface.Ping(toSend); } } catch (BusException e) { e.printStackTrace(); } }
From source file:ac.robinson.bettertogether.hotspot.HotspotManagerService.java
@SuppressFBWarnings("ANDROID_BROADCAST") private void sendBroadcastMessageToAllLocalClients(BroadcastMessage msg) { for (int i = mClients.size() - 1; i >= 0; i--) { try {/*from www .jav a 2 s.c o m*/ // local directly connected activities (i.e., ours) Messenger client = mClients.get(i); Message message = Message.obtain(null, MSG_BROADCAST); message.replyTo = mMessenger; Bundle bundle = new Bundle(1); bundle.putSerializable(PluginIntent.KEY_BROADCAST_MESSAGE, msg); message.setData(bundle); client.send(message); // local unconnected activities (i.e., plugins) Log.d(TAG, "Sending broadcast message to all local clients with package " + mConnectionOptions.mPluginPackage + " - type: " + msg.getType() + ", message: " + msg.getMessage()); Intent broadcastIntent = new Intent(PluginIntent.ACTION_MESSAGE_RECEIVED); broadcastIntent.setClassName(mConnectionOptions.mPluginPackage, PluginIntent.MESSAGE_RECEIVER); // TODO: source is only necessary for internal plugins - remove later? broadcastIntent.putExtra(PluginIntent.EXTRA_SOURCE, HotspotManagerService.this.getPackageName()); broadcastIntent.putExtra(PluginIntent.KEY_BROADCAST_MESSAGE, msg); sendBroadcast(broadcastIntent); } catch (RemoteException e) { e.printStackTrace(); mClients.remove(i); // client is dead - ok to remove here as we're reversing through the list } } }
From source file:com.example.innf.newchangtu.Map.view.activity.MainActivity.java
@Override protected void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); Log.d(TAG, "onSaveInstanceState: is called"); savedInstanceState.putSerializable(KEY_TRACK, mTrack); savedInstanceState.putString(KEY_START_POSITION, mStartPosition); savedInstanceState.putString(KEY_END_POSITION, mEndPosition); savedInstanceState.putInt(KEY_TIME_INTERVAL, mTimeInterval); savedInstanceState.putString(KEY_PHONE, mPhone); // savedInstanceState.putParcelableArrayList(KEY_POSITION_LIST, mPositionList); }
From source file:com.ebridgevas.android.ebridgeapp.messaging.mqttservice.MqttService.java
/** * trace exceptions/*from w ww .j a va2 s .com*/ * * @param tag * identifier for the source of the trace * @param message * the text to be traced * @param e * the exception */ @Override public void traceException(String tag, String message, Exception e) { if (traceCallbackId != null) { Bundle dataBundle = new Bundle(); dataBundle.putString(MqttServiceConstants.CALLBACK_ACTION, MqttServiceConstants.TRACE_ACTION); dataBundle.putString(MqttServiceConstants.CALLBACK_TRACE_SEVERITY, MqttServiceConstants.TRACE_EXCEPTION); dataBundle.putString(MqttServiceConstants.CALLBACK_ERROR_MESSAGE, message); dataBundle.putSerializable(MqttServiceConstants.CALLBACK_EXCEPTION, e); //TODO: Check dataBundle.putString(MqttServiceConstants.CALLBACK_TRACE_TAG, tag); //dataBundle.putString(MqttServiceConstants.CALLBACK_TRACE_ID, traceCallbackId); callbackToActivity(traceCallbackId, Status.ERROR, dataBundle); } }
From source file:com.cw.litenote.note_add.Note_addCameraImage.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); System.out.println("Note_addCameraImage / onSaveInstanceState"); if (bUseCameraImage) { outState.putBoolean("UseCameraImage", true); outState.putString("showCameraImageUri", cameraImageUri); } else {//from w ww . j av a 2 s.c o m outState.putBoolean("UseCameraImage", false); outState.putString("showCameraImageUri", ""); } // if confirmation dialog still shows? if (UtilImage.bShowExpandedImage == true) { outState.putBoolean("ShowConfirmContinueDialog", true); } else outState.putBoolean("ShowConfirmContinueDialog", false); outState.putSerializable(DB_page.KEY_NOTE_ID, noteId); }
From source file:cc.mintcoin.wallet.ui.SendCoinsFragment.java
private void saveInstanceState(final Bundle outState) { outState.putParcelable("payment_intent", paymentIntent); outState.putSerializable("state", state); if (validatedAddress != null) outState.putParcelable("validated_address", validatedAddress); if (sentTransaction != null) outState.putSerializable("sent_transaction_hash", sentTransaction.getHash()); if (directPaymentAck != null) outState.putBoolean("direct_payment_ack", directPaymentAck); }