List of usage examples for android.os Bundle putByteArray
@Override public void putByteArray(@Nullable String key, @Nullable byte[] value)
From source file:Main.java
public static Message getMessage(int statusCode, byte[] responseBody) { Message message = new Message(); message.what = statusCode;/*from w ww.j a v a 2 s. com*/ Bundle bundle = new Bundle(1); bundle.putByteArray("response", responseBody); message.setData(bundle); return message; }
From source file:com.hat.tools.HttpUtils.java
public static void SendRequest(String url, Handler handler) { HttpGet request = new HttpGet(url); HttpClient httpClient = new DefaultHttpClient(); byte[] data = null; InputStream in = null;/* w ww.ja v a 2 s.com*/ try { HttpResponse response = httpClient.execute(request); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { ByteArrayOutputStream out = new ByteArrayOutputStream(); in = response.getEntity().getContent(); byte[] buf = new byte[1024]; int len = 0; while ((len = in.read(buf)) != -1) { out.write(buf, 0, len); } data = out.toByteArray(); Message msg = new Message(); msg.what = HTTP_FINISH; Bundle bundle = new Bundle(); bundle.putByteArray("data", data); msg.setData(bundle); handler.sendMessage(msg); out.close(); } } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { if (in != null) in.close(); } catch (IOException e) { e.printStackTrace(); } } }
From source file:id.nci.stm_9.ImportKeysListFragment.java
/** * Creates new instance of this fragment *///w w w . j a va 2 s . c o m public static ImportKeysListFragment newInstance(byte[] bytes, String filename) { ImportKeysListFragment frag = new ImportKeysListFragment(); Bundle args = new Bundle(); args.putByteArray(ARG_BYTES, bytes); args.putString(ARG_FILENAME, filename); frag.setArguments(args); return frag; }
From source file:moe.yukinoneko.gcomic.module.gallery.PictureFragment.java
public static PictureFragment newInstance(String picUrl, byte[] picByte, boolean isFromDisk) { PictureFragment fragment = new PictureFragment(); Bundle args = new Bundle(); args.putString(PIC_URL, picUrl); args.putByteArray(PIC_BYTE, picByte); args.putBoolean(IS_FROM_DISK, isFromDisk); fragment.setArguments(args);/*from ww w . j a va2 s. c o m*/ return fragment; }
From source file:net.named_data.nfd.FaceStatusFragment.java
/** * Create a new instance of {@link net.named_data.nfd.FaceStatusFragment} with * the given detail face information as a byte array object. * //from w w w . j a va 2s . c o m * Note: * faceStatus.wireEncode().getImmutableArray() * This byte array should be retrieved via a call to: * {@link com.intel.jndn.management.types.FaceStatus#wireEncode()} for a * {@link net.named_data.jndn.util.Blob} object. Subsequently, an * immutable byte array can be retrieved via * {@link net.named_data.jndn.util.Blob#getImmutableArray()}. * * @param faceStatus FaceStatus instance with information about the face * @return Fragment instance of {@link net.named_data.nfd.FaceStatusFragment} * that is ready for use by the hosting activity */ public static FaceStatusFragment newInstance(FaceStatus faceStatus) { Bundle args = new Bundle(); args.putByteArray(EXTRA_FACE_INFORMATION, faceStatus.wireEncode().getImmutableArray()); FaceStatusFragment fragment = new FaceStatusFragment(); fragment.setArguments(args); return fragment; }
From source file:org.sufficientlysecure.keychain.ui.CreateYubiKeyImportFragment.java
public static Fragment newInstance(byte[] scannedFingerprints, byte[] nfcAid, String userId) { CreateYubiKeyImportFragment frag = new CreateYubiKeyImportFragment(); Bundle args = new Bundle(); args.putByteArray(ARG_FINGERPRINT, scannedFingerprints); args.putByteArray(ARG_AID, nfcAid);//from www .j a v a 2 s . c om args.putString(ARG_USER_ID, userId); frag.setArguments(args); return frag; }
From source file:com.google.android.apps.forscience.whistlepunk.EditNoteDialog.java
public static EditNoteDialog newInstance(Label label, GoosciLabelValue.LabelValue selectedValue, String timeText, long timestamp, String timeTextDescription) { EditNoteDialog dialog = new EditNoteDialog(); Bundle args = new Bundle(); args.putParcelable(KEY_SAVED_LABEL, label); args.putByteArray(KEY_SELECTED_VALUE, ProtoUtils.makeBlob(selectedValue)); args.putString(KEY_SAVED_TIME_TEXT, timeText); args.putLong(KEY_SAVED_TIMESTAMP, timestamp); args.putString(KEY_SAVED_TIME_TEXT_DESCRIPTION, timeTextDescription); dialog.setArguments(args);//w ww . j a v a2 s . co m return dialog; }
From source file:org.sufficientlysecure.keychain.ui.CreateKeyYubiKeyImportFragment.java
public static Fragment createInstance(byte[] scannedFingerprints, byte[] nfcAid, String userId) { CreateKeyYubiKeyImportFragment frag = new CreateKeyYubiKeyImportFragment(); Bundle args = new Bundle(); args.putByteArray(ARG_FINGERPRINT, scannedFingerprints); args.putByteArray(ARG_AID, nfcAid);//from w ww .j a va 2 s . c om args.putString(ARG_USER_ID, userId); frag.setArguments(args); return frag; }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyYubiKeyFragment.java
public static ViewKeyYubiKeyFragment newInstance(long masterKeyId, byte[] fingerprints, String userId, byte[] aid) { ViewKeyYubiKeyFragment frag = new ViewKeyYubiKeyFragment(); Bundle args = new Bundle(); args.putLong(ARG_MASTER_KEY_ID, masterKeyId); args.putByteArray(ARG_FINGERPRINT, fingerprints); args.putString(ARG_USER_ID, userId); args.putByteArray(ARG_CARD_AID, aid); frag.setArguments(args);/*from w w w . ja v a 2 s . c o m*/ return frag; }
From source file:org.sufficientlysecure.keychain.ui.ViewKeySecurityTokenFragment.java
public static ViewKeySecurityTokenFragment newInstance(long masterKeyId, byte[] fingerprints, String userId, byte[] aid, double version) { ViewKeySecurityTokenFragment frag = new ViewKeySecurityTokenFragment(); Bundle args = new Bundle(); args.putLong(ARG_MASTER_KEY_ID, masterKeyId); args.putByteArray(ARG_FINGERPRINT, fingerprints); args.putString(ARG_USER_ID, userId); args.putByteArray(ARG_CARD_AID, aid); args.putDouble(ARG_CARD_VERSION, version); frag.setArguments(args);// w w w. j ava 2s . c o m return frag; }