已解码的字符串图像在Android中不能显示为位图

已解码的字符串图像在Android中不能显示为位图,android,android-intent,bitmap,base64,Android,Android Intent,Bitmap,Base64,下面是我在android项目中通过导入android.util.base64将图像文件从位图编码为base64字符串的代码部分: ` ` 字符串配置文件\u img将作为字符串保存在mysql数据库中。 当我从数据库中检索字符串值时,我将使用以下代码将图像字符串从字符串解码为位图: ` ` 我希望它会显示图像,但是图像没有显示,我从Base64解码器得到一条日志消息--decoder->decode returned false 有人能帮我找出代码中的错误吗 还有谁知道如何将base64字符串图

下面是我在android项目中通过导入android.util.base64将图像文件从位图编码为base64字符串的代码部分: `

` 字符串配置文件\u img将作为字符串保存在mysql数据库中。 当我从数据库中检索字符串值时,我将使用以下代码将图像字符串从字符串解码为位图:

`

` 我希望它会显示图像,但是图像没有显示,我从Base64解码器得到一条日志消息--decoder->decode returned false

有人能帮我找出代码中的错误吗

还有谁知道如何将base64字符串图像从JSON转换为php脚本,转换成blob格式,这样我就可以在mysql中将其存储为blob。 提前谢谢。

browseImageURI有什么价值?也许这有帮助
Bitmap img_bmp=BitmapFactory.decodeStream(getContentResolver().
openInputStream(this.browseImageURI));

ByteArrayOutputStream baos = new ByteArrayOutputStream();  
img_bmp.compress(Bitmap.CompressFormat.JPEG, 30, baos); 
byte[] image = baos.toByteArray();
 String profile_img = Base64.encodeToString(image, Base64.DEFAULT);
Intent i = getIntent(); //pass the value from previous activity
str_img= i.getStringExtra("img");
img_bm = StringToBitMap(str_img);
imgview = (ImageView)findViewById(R.id.imageView1);
imgview.setImageBitmap(img_bm); // display the image

//Function to convert string to bitmap
    public Bitmap StringToBitMap(String image){
           try{
               byte [] encodeByte=Base64.decode(image,Base64.DEFAULT);
               Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
               return bitmap;
             }catch(Exception e){
               e.getMessage();
              return null;
             }
     }