Java 在android上将图像转换为二进制
如何将图像转换为二进制并在Java 在android上将图像转换为二进制,java,android,bitmap,binary,Java,Android,Bitmap,Binary,如何将图像转换为二进制并在文本视图上显示结果 我尝试了这个源代码,但我不能继续,我是新手 protected void onActivityResult(int codeA, int resl, Intent data){ if(codeA == HASIL_LOAD_PICT && resl == RESULT_OK && null !=data){ Uri choosepict = data.getData(); Str
文本视图上显示结果
我尝试了这个源代码,但我不能继续,我是新手
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));
}
}
请为图像尝试以下操作:
bmImage.setImageBitmap(BitmapFactory.decodeByteArray(byteImage2, 0, byteImage2.length));
难道你不直接读取流而不是解码它吗?