如何将图像转换为二进制并在Text view
上显示结果
我尝试了这个源代码,但我无法继续,我是新手。
protected void onActivityResult(int codeA, int resl, Intent data){
if(codeA == HASIL_LOAD_PICT && resl == RESULT_OK && null !=data){
Uri choosepict = data.getData();
String[] filepath = {MediaStore.Images.Media.DATA};
Cursor cr = getContentResolver().query(choosepict, filepath, null, null, null);
cr.moveToFirst();
int colIndex = cr.getColumnIndex(filepath[0]);
String filepathme = cr.getString(colIndex);
cr.close();
ImageView iv = (ImageView) findViewById(R.id.imgView);
iv.setImageBitmap(BitmapFactory.decodeFile(filepathme));
}
}
答案 0 :(得分:0)
尝试以下图片:
bmImage.setImageBitmap(BitmapFactory.decodeByteArray(byteImage2, 0, byteImage2.length));