Can I store image files in firebase using Java API?

烈酒焚心 提交于 2019-11-29 15:50:32

问题


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 using Java API and still there is no answer. I know that there is an official api for it, called firepano here is the link https://github.com/firebase/firepano but it is for Javascript library.

is there any solution for Java library??


回答1:


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);     


来源:https://stackoverflow.com/questions/26538704/can-i-store-image-files-in-firebase-using-java-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!