getBitmapByte

	public byte[] getBitmapByte(Drawable drawalbe) {
		BitmapDrawable db = (BitmapDrawable) drawalbe;
		Bitmap bitmap = db.getBitmap();
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
		try {
			out.flush();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();

		}
		return out.toByteArray();
	}

你可能感兴趣的:(java)