0

如何将图像转换为二进制并显示结果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));
    }
}
4

1 回答 1

0

尝试以下图像:

   bmImage.setImageBitmap(BitmapFactory.decodeByteArray(byteImage2, 0, byteImage2.length));
于 2012-10-10T04:09:42.983 回答