當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。