本文整理汇总了Java中android.os.Bundle.putByteArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putByteArray方法的具体用法?Java Bundle.putByteArray怎么用?Java Bundle.putByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.putByteArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bundleThumbnail
import android.os.Bundle; //导入方法依赖的package包/类
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
int[] pixels = source.renderThumbnail();
int width = source.getThumbnailWidth();
int height = source.getThumbnailHeight();
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
示例2: licensePressed
import android.os.Bundle; //导入方法依赖的package包/类
@OnClick(R.id.license_image)
void licensePressed() {
final Intent intent = new Intent(this, PictureZoomActivity.class);
final Bundle extras = new Bundle();
extras.putByteArray("picture", licence.getPhoto());
intent.putExtras(extras);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, headshot, "zoom");
startActivity(intent, options.toBundle());
}
示例3: setAvator
import android.os.Bundle; //导入方法依赖的package包/类
public void setAvator(Bitmap bitmap, IUiListener iUiListener) {
Bundle composeCGIParams = composeCGIParams();
OutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.JPEG, 40, byteArrayOutputStream);
byte[] toByteArray = byteArrayOutputStream.toByteArray();
bitmap.recycle();
IRequestListener tempRequestListener = new TempRequestListener(iUiListener);
composeCGIParams.putByteArray(SocialConstants.PARAM_AVATAR_URI, toByteArray);
HttpUtils.requestAsync(this.mToken, Global.getContext(), "user/set_user_face", composeCGIParams, "POST", tempRequestListener);
d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_SET_AVATAR_SUCCEED, "12", "19", "0");
}
示例4: onNewDevice
import android.os.Bundle; //导入方法依赖的package包/类
public void onNewDevice(short devAddr, byte[] uuid) {
Message msg = new Message();
Bundle bundle = new Bundle();
bundle.putByte(MESH_EVT_MSG_PAR_KEY_EVENT, MESH_EVENT_ON_NEW_DEVICE);
bundle.putShort(MESH_EVT_MSG_PAR_KEY_DEVADDR, devAddr);
bundle.putByteArray(MESH_EVT_MSG_PAR_KEY_UUID, uuid);
msg.setData(bundle);
mEvtHdl.sendMessage(msg);
}
示例5: regResponseMsgListener
import android.os.Bundle; //导入方法依赖的package包/类
/**
* 注册监听响应的msg.
*
* @param context c
* @param msgListenerKey listerId 用于在map中标识监听器
* @param handler 用于回传响应的数据
* @param sendBothwayId 发送时的BothwayId.
*/
private static void regResponseMsgListener(
final Context context, final long msgListenerKey,
@NonNull final Handler handler, @NonNull final byte[] sendBothwayId) {
WTResponseMsgListener listener = new WTResponseMsgListener() {
@Override
public void onResponseMsgReceived(String path, byte[] data, byte[] bothwayId) {
//判断与发送时的path是否对应,避免同时发送2个请求时响应混乱。
if (!Arrays.equals(sendBothwayId, bothwayId)) return;
//双向通讯响应path格式为:/RE/WTBothway/{nanoTime}/xxx
Message msg = handler.obtainMessage(HANDLER_RECEIVE_RESPONSE);
Bundle bundle = new Bundle();
bundle.putByteArray("data", data);
bundle.putString("path", path);
msg.setData(bundle);
handler.sendMessage(msg);
if (msgListenerMap.get(msgListenerKey) != null) {
WTLog.v(TAG, "Remove response msg listener.");
WTRegister.removeMessageListener(context, msgListenerMap.get(msgListenerKey));
msgListenerMap.remove(msgListenerKey);
}
}
};
WTLog.v(TAG, "Register response msg listener.");
msgListenerMap.put(msgListenerKey, listener);
WTRegister.addMessageListener(context, listener);
}
示例6: bundleThumbnail
import android.os.Bundle; //导入方法依赖的package包/类
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
int[] pixels = source.renderThumbnail();
int width = source.getThumbnailWidth();
int height = source.getThumbnailHeight();
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
示例7: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
public static ShareForumFragment newInstance(GroupId groupId) {
Bundle args = new Bundle();
args.putByteArray(GROUP_ID, groupId.getBytes());
ShareForumFragment fragment = new ShareForumFragment();
fragment.setArguments(args);
return fragment;
}
示例8: bundleThumbnail
import android.os.Bundle; //导入方法依赖的package包/类
/**
* create thumbnail
*
* @param source
* @param bundle
*/
private void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
int[] pixels = source.renderThumbnail();
int width = source.getThumbnailWidth();
int height = source.getThumbnailHeight();
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.RGB_565);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
示例9: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
public void onSaveInstanceState(Bundle outState) {
Parcel outParcel = Parcel.obtain();
outParcel.writeSparseBooleanArray(mCheckStates);
final int numStates = mCheckedIdStates.size();
outParcel.writeInt(numStates);
for (int i=0; i<numStates; i++) {
outParcel.writeLong(mCheckedIdStates.keyAt(i));
outParcel.writeInt(mCheckedIdStates.valueAt(i));
}
byte[] states = outParcel.marshall();
outState.putByteArray(SELECTED_ITEMS_KEY, states);
outParcel.recycle();
}
示例10: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
public static RevealContactsFragment newInstance(GroupId groupId) {
Bundle args = new Bundle();
args.putByteArray(GROUP_ID, groupId.getBytes());
RevealContactsFragment fragment = new RevealContactsFragment();
fragment.setArguments(args);
return fragment;
}
示例11: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
ThreadItem replyItem = adapter.getHighlightedItem();
if (replyItem != null) {
outState.putByteArray(KEY_REPLY_ID, replyItem.getId().getBytes());
}
}
示例12: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
public static GroupInviteFragment newInstance(GroupId groupId) {
Bundle args = new Bundle();
args.putByteArray(GROUP_ID, groupId.getBytes());
GroupInviteFragment fragment = new GroupInviteFragment();
fragment.setArguments(args);
return fragment;
}
示例13: bundleThumbnail
import android.os.Bundle; //导入方法依赖的package包/类
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
int[] pixels = source.renderThumbnail();
int width = source.getThumbnailWidth();
int height = source.getThumbnailHeight();
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
示例14: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle state) {
super.onSaveInstanceState(state);
if (localAuthorId != null) {
byte[] b = localAuthorId.getBytes();
state.putByteArray("briar.LOCAL_AUTHOR_ID", b);
}
state.putInt("briar.LOCAL_CODE", localInvitationCode);
state.putInt("briar.REMOTE_CODE", remoteInvitationCode);
state.putBoolean("briar.FAILED", connectionFailed);
state.putString("briar.CONTACT_NAME", contactName);
if (task != null) state.putLong("briar.TASK_HANDLE", taskHandle);
}
示例15: saveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
private void saveInstanceState(final Bundle outState) {
outState.putByteArray("receive_address", address.getHash160());
}