当前位置: 首页>>代码示例>>Java>>正文


Java Bundle.getByteArray方法代码示例

本文整理汇总了Java中android.os.Bundle.getByteArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getByteArray方法的具体用法?Java Bundle.getByteArray怎么用?Java Bundle.getByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.getByteArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {

	Bundle args = getArguments();
	blogId = new GroupId(args.getByteArray(GROUP_ID));
	postId = new MessageId(args.getByteArray(POST_ID));

	View v = inflater.inflate(R.layout.fragment_reblog, container, false);
	ui = new ViewHolder(v);
	ui.post.setTransitionName(postId);
	ui.input.setSendButtonEnabled(false);
	showProgressBar();

	return v;
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:18,代码来源:ReblogFragment.java

示例2: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle bundle) {
	super.onCreate(bundle);

	setContentView(getLayout());

	if (bundle != null) {
		// restore group ID if it was saved
		byte[] groupBytes = bundle.getByteArray(GROUP_ID);
		if (groupBytes != null) groupId = new GroupId(groupBytes);
		// restore selected contacts if a selection was saved
		ArrayList<Integer> intContacts =
				bundle.getIntegerArrayList(CONTACTS);
		if (intContacts != null) {
			contacts = getContactsFromIntegers(intContacts);
		}
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:19,代码来源:ContactSelectorActivity.java

示例3: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_result);
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
        if (compressedBitmap != null) {
            mBitmap = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
            mBitmap = mBitmap.copy(Bitmap.Config.ARGB_8888, true);
        }

        mResultStr = extras.getString(BUNDLE_KEY_SCAN_RESULT);
        mDecodeMode = extras.getInt(DecodeThread.DECODE_MODE);
        mDecodeTime = extras.getString(DecodeThread.DECODE_TIME);
    }
    initViews();
}
 
开发者ID:snice,项目名称:androidscan,代码行数:19,代码来源:ResultActivity.java

示例4: onRestoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
public void onRestoreInstanceState(Bundle savedInstanceState) {
    byte[] states = savedInstanceState.getByteArray(SELECTED_ITEMS_KEY);
    if ( null != states ) {
        Parcel inParcel = Parcel.obtain();
        inParcel.unmarshall(states, 0, states.length);
        inParcel.setDataPosition(0);
        mCheckStates = inParcel.readSparseBooleanArray();
        final int numStates = inParcel.readInt();
        mCheckedIdStates.clear();
        for (int i=0; i<numStates; i++) {
            final long key = inParcel.readLong();
            final int value = inParcel.readInt();
            mCheckedIdStates.put(key, value);
        }
    }
}
 
开发者ID:changja88,项目名称:Udacity_Sunshine,代码行数:17,代码来源:ItemChoiceManager.java

示例5: unbundle

import android.os.Bundle; //导入方法依赖的package包/类
public static TestClassBundled unbundle(Bundle bundle, Gson gson) {
    return new AutoValue_TestClassBundled(
            bundle,
            bundle.getByte("some_byte"),
            bundle.getBoolean("some_boolean"),
            bundle.getShort("some_short"),
            bundle.getInt("some_int"),
            bundle.getLong("some_long"),
            bundle.getChar("some_char"),
            bundle.getFloat("some_float"),
            bundle.getDouble("some_double"),
            bundle.getString("some_string"),
            bundle.getCharSequence("some_char_sequence"),
            bundle.getParcelable("some_parcelable"),
            bundle.getParcelableArrayList("some_parcelable_array_list"),
            bundle.getSparseParcelableArray("some_parcelable_sparse_array"),
            bundle.getSerializable("some_serializable"),
            bundle.getIntegerArrayList("some_integer_array_list"),
            bundle.getStringArrayList("some_string_array_list"),
            bundle.getCharSequenceArrayList("some_char_sequence_array_list"),
            bundle.getByteArray("some_byte_array"),
            bundle.getShortArray("some_short_array"),
            bundle.getCharArray("some_char_array"),
            bundle.getFloatArray("some_float_array"),
            gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()),
            gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()),
            gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType()));
}
 
开发者ID:uber,项目名称:auto-value-bundle,代码行数:29,代码来源:AutoValue_TestClassBundled.java

示例6: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_result);

	Bundle extras = getIntent().getExtras();

	mResultImage = (ImageView) findViewById(R.id.result_image);
	mResultText = (TextView) findViewById(R.id.result_text);

	if (null != extras) {
		int width = extras.getInt("width");
		int height = extras.getInt("height");

		LayoutParams lps = new LayoutParams(width, height);
		lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
		lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
		lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
		
		mResultImage.setLayoutParams(lps);

		String result = extras.getString("result");
		mResultText.setText(result);

		Bitmap barcode = null;
		byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
		if (compressedBitmap != null) {
			barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
			// Mutable copy:
			barcode = barcode.copy(Bitmap.Config.RGB_565, true);
		}

		mResultImage.setImageBitmap(barcode);
	}
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:36,代码来源:ResultActivity.java

示例7: onCreateView

import android.os.Bundle; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {

	Bundle args = getArguments();
	byte[] b = args.getByteArray(GROUP_ID);
	if (b == null) throw new IllegalStateException("No group ID in args");
	blogId = new GroupId(b);

	return super.onCreateView(inflater, container, savedInstanceState);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:14,代码来源:FeedPostFragment.java

示例8: handleMessage

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void handleMessage(Message message) {
    switch (message.what) {
        case MESSAGE_RESTART_PREVIEW:
            restartPreviewAndDecode();
            break;
        case MESSAGE_DECODE_SUCCEEDED:
            state = State.SUCCESS;
            Bundle bundle = message.getData();
            Bitmap barcode = null;
            float scaleFactor = 1.0f;
            if (bundle != null) {
                byte[] compressedBitmap = bundle.getByteArray(DecodeThread.BARCODE_BITMAP);
                if (compressedBitmap != null) {
                    barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
                    // Mutable copy:
                    barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
                }
                scaleFactor = bundle.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
            }
            barcodeReaderView.handleDecode((Result) message.obj, barcode, scaleFactor);
            break;
        case MESSAGE_DECODE_FAILED:
            // We're decoding as fast as possible, so when one decode fails, start another.
            state = State.PREVIEW;
            cameraManager.requestPreviewFrame(decodeThread.getHandler(), MESSAGE_DECODE);
            break;
    }
}
 
开发者ID:CoderChoy,项目名称:BarcodeReaderView,代码行数:30,代码来源:BarcodeReaderHandler.java

示例9: onRestoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * recupera el estat de la activity
 */
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    if (savedInstanceState.getByteArray(PHOTO_INTENT) != null) {
        ImageView imageView = findViewById(R.id.imgPhoto);
        Bitmap bitmap = BitmapFactory.decodeByteArray(savedInstanceState.getByteArray(PHOTO_INTENT)
                , 0
                , savedInstanceState.getByteArray(PHOTO_INTENT).length);
        imageView.setImageBitmap(bitmap);
    }
}
 
开发者ID:gothalo,项目名称:Android-2017,代码行数:16,代码来源:MainActivity.java

示例10: BluetoothLeDevice

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * Instantiates a new bluetooth le device.
 *
 * @param in the in
 */
@SuppressWarnings("unchecked")
protected BluetoothLeDevice(final Parcel in) {
    final Bundle b = in.readBundle(getClass().getClassLoader());
    mCurrentRssi = b.getInt(PARCEL_EXTRA_CURRENT_RSSI, 0);
    mCurrentTimestamp = b.getLong(PARCEL_EXTRA_CURRENT_TIMESTAMP, 0);
    mDevice = b.getParcelable(PARCEL_EXTRA_BLUETOOTH_DEVICE);
    mFirstRssi = b.getInt(PARCEL_EXTRA_FIRST_RSSI, 0);
    mFirstTimestamp = b.getLong(PARCEL_EXTRA_FIRST_TIMESTAMP, 0);
    mRecordStore = b.getParcelable(PARCEL_EXTRA_DEVICE_SCANRECORD_STORE);
    mRssiLog = (Map<Long, Integer>) b.getSerializable(PARCEL_EXTRA_DEVICE_RSSI_LOG);
    mScanRecord = b.getByteArray(PARCEL_EXTRA_DEVICE_SCANRECORD);
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:18,代码来源:BluetoothLeDevice.java

示例11: handleNotify

import android.os.Bundle; //导入方法依赖的package包/类
private void handleNotify(Bundle bundle) {
    if (null == bundle) {
        LogUtils.w(TAG, "handleNotify():bundle = null");
        return;
    }
    byte[] byteArray = bundle.getByteArray(Key.KEY_CHARACTER_NOTIFY);
    builder.append(HexUtil.encodeHexStr(byteArray) + "\n");
    tvShow.setText(builder.toString());
}
 
开发者ID:TommyFen,项目名称:NaiveDemos,代码行数:10,代码来源:BleServiceTestActivity.java

示例12: handleMessage

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void handleMessage(Message message) {
	if (message.what == R.id.restart_preview) {
		restartPreviewAndDecode();

	} else if (message.what == R.id.decode_succeeded) {
		state = State.SUCCESS;
		Bundle bundle = message.getData();
		Bitmap barcode = null;
		float scaleFactor = 1.0f;
		if (bundle != null) {
			byte[] compressedBitmap = bundle
					.getByteArray(DecodeThread.BARCODE_BITMAP);
			if (compressedBitmap != null) {
				barcode = BitmapFactory.decodeByteArray(compressedBitmap,
						0, compressedBitmap.length, null);
				// Mutable copy:
				barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
			}
			scaleFactor = bundle
					.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
		}
		activity.handleDecode((Result) message.obj, barcode, scaleFactor);

	} else if (message.what == R.id.decode_failed) {// We're decoding as fast as possible, so when one decode fails,
		// start another.
		state = State.PREVIEW;
		cameraManager.requestPreviewFrame(decodeThread.getHandler(),
				R.id.decode);

	} else if (message.what == R.id.return_scan_result) {
		activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
		activity.finish();

	} else if (message.what == R.id.launch_product_query) {
		String url = (String) message.obj;

		Intent intent = new Intent(Intent.ACTION_VIEW);
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
		intent.setData(Uri.parse(url));

		ResolveInfo resolveInfo = activity.getPackageManager()
				.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
		String browserPackageName = null;
		if (resolveInfo != null && resolveInfo.activityInfo != null) {
			browserPackageName = resolveInfo.activityInfo.packageName;
			Log.d(TAG, "Using browser in package " + browserPackageName);
		}

		// Needed for default Android browser / Chrome only apparently
		if ("com.android.browser".equals(browserPackageName)
				|| "com.android.chrome".equals(browserPackageName)) {
			intent.setPackage(browserPackageName);
			intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			intent.putExtra(Browser.EXTRA_APPLICATION_ID,
					browserPackageName);
		}

		try {
			activity.startActivity(intent);
		} catch (ActivityNotFoundException ignored) {
			Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
		}

	}
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:67,代码来源:CaptureActivityHandler.java

示例13: getByteArray

import android.os.Bundle; //导入方法依赖的package包/类
public byte[] getByteArray(Bundle state, String key) {
    return state.getByteArray(key + mBaseKey);
}
 
开发者ID:evernote,项目名称:android-state,代码行数:4,代码来源:InjectionHelper.java

示例14: unserialize

import android.os.Bundle; //导入方法依赖的package包/类
public void unserialize(Bundle bundle) {
    this.imageData = bundle.getByteArray("_wximageobject_imageData");
    this.imagePath = bundle.getString("_wximageobject_imagePath");
    this.imageUrl = bundle.getString("_wximageobject_imageUrl");
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:6,代码来源:WXImageObject.java

示例15: upload

import android.os.Bundle; //导入方法依赖的package包/类
public static Statistic upload(Context context, String str, Bundle bundle) throws MalformedURLException, IOException, NetworkUnavailableException, HttpStatusException {
    int size;
    int i;
    byte[] byteArray;
    if (context != null) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        if (connectivityManager != null) {
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
            if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
                throw new NetworkUnavailableException(NetworkUnavailableException.ERROR_INFO);
            }
        }
    }
    Bundle bundle2 = new Bundle(bundle);
    String str2 = "";
    str2 = bundle2.getString("appid_for_getting_config");
    bundle2.remove("appid_for_getting_config");
    HttpClient httpClient = HttpUtils.getHttpClient(context, str2, str);
    HttpUriRequest httpPost = new HttpPost(str);
    Bundle bundle3 = new Bundle();
    for (String str22 : bundle2.keySet()) {
        Object obj = bundle2.get(str22);
        if (obj instanceof byte[]) {
            bundle3.putByteArray(str22, (byte[]) obj);
        }
    }
    httpPost.setHeader(HttpRequest.HEADER_CONTENT_TYPE, "multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f");
    httpPost.setHeader("Connection", "Keep-Alive");
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    byteArrayOutputStream.write(getBytesUTF8("--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
    byteArrayOutputStream.write(getBytesUTF8(encodePostBody(bundle2, "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f")));
    if (!bundle3.isEmpty()) {
        size = bundle3.size();
        byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
        i = -1;
        for (String str222 : bundle3.keySet()) {
            i++;
            byteArrayOutputStream.write(getBytesUTF8("Content-Disposition: form-data; name=\"" + str222 + "\"; filename=\"" + "value.file" + "\"" + "\r\n"));
            byteArrayOutputStream.write(getBytesUTF8("Content-Type: application/octet-stream\r\n\r\n"));
            byteArray = bundle3.getByteArray(str222);
            if (byteArray != null) {
                byteArrayOutputStream.write(byteArray);
            }
            if (i < size - 1) {
                byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
            }
        }
    }
    byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f--\r\n"));
    byteArray = byteArrayOutputStream.toByteArray();
    i = byteArray.length + 0;
    byteArrayOutputStream.close();
    httpPost.setEntity(new ByteArrayEntity(byteArray));
    HttpResponse execute = httpClient.execute(httpPost);
    size = execute.getStatusLine().getStatusCode();
    if (size == 200) {
        return new Statistic(a(execute), i);
    }
    throw new HttpStatusException(HttpStatusException.ERROR_INFO + size);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:61,代码来源:Util.java


注:本文中的android.os.Bundle.getByteArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。