将base64字符串从firebase编码到RecylclerView时出现问题

时间:2016-05-28 08:50:38

标签: android firebase base64 firebase-realtime-database

使用firebase运行的我的应用程序和成功上传图片编码为我的json

字符串

我的Json on Firebase

enter image description here MyAdapter.java

@Override
public void onBindViewHolder(MyHolder holder, int position) {
    String name = movies.get(position).getName();
    String desk = movies.get(position).getDescription();

    holder.nameTxt.setText(name);
    holder.tvDesk.setText(desk);

    String image = movies.get(position).getImageFile();
    byte[] decodedString = Base64.decode(image, Base64.DEFAULT);
    Bitmap bitmap = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
    holder.ivprofile.setImageBitmap(bitmap);

    PiccassoClient.downloadImage(c,movies.get(position).getUrl(),holder.img);
}

logcat的

FATAL EXCEPTION: main                                                        Process: com.squad.utif.rvtext, PID: 2543
Theme: themes:{}                                                java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes()' on a null object reference
at android.util.Base64.decode(Base64.java:118)
at com.squad.utif.rvtext.Recycler.MyAdapter.onBindViewHolder(MyAdapter.java:49)
at com.squad.utif.rvtext.Recycler.MyAdapter.onBindViewHolder(MyAdapter.java:23)

编码出了什么问题?

0 个答案:

没有答案