Can I store image files in firebase using Java API?

后端 未结 1 1481
渐次进展
渐次进展 2021-01-01 05:16

Is there any way to store image files in firebase using Java api to be used for android application?

I have read this thread Can I store image files in firebase usin

相关标签:
1条回答
  • 2021-01-01 05:21

    I used this code and now it's working:

      Bitmap bmp =  BitmapFactory.decodeResource(getResources(),
            R.drawable.chicken);//your image
    ByteArrayOutputStream bYtE = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.PNG, 100, bYtE);
    bmp.recycle();
    byte[] byteArray = bYtE.toByteArray();
    String imageFile = Base64.encodeToString(byteArray, Base64.DEFAULT);     
    
    0 讨论(0)
提交回复
热议问题