我有什么:我正在使用相机来捕捉图像,我希望通过将位图传递给android中的适配器来将其显示在列表视图中
private void startCameraCapture() {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
if (cameraIntent.resolveActivity(getActivity().getPackageManager()) != null) {
startActivityForResult(cameraIntent, 1024);
}
}
public void onActivityResult(int requestCode, int resultCode, Intent myData) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == 1024) {
.............. mycode
}
}
我想做什么 ::我想将我收到的数据myData
转换为android中的位图
答案 0 :(得分:0)
将byte []转换为位图
Bitmap bmp = myData.getExtras().get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();