简体   繁体   中英

Converting an image into byte array in a Java class

I am developing an Android application where I need to convert an image into a Byte array. I know that it can't be done with JavaScript. I thought maybe I can use a Java class, is that possible? If it is, how do I do that?

I believe what you're looking for is a plugin for Android Phonegap applications. Have a look through this documentation and see if it fits your needs.

http://docs.phonegap.com/en/2.2.0/guide_plugin-development_android_index.md.html

Edit: Perhaps then a better solution is use the FileReader API. You can read a file as base64 encoded string and break that into the byte array you need.

http://docs.phonegap.com/en/2.2.0/cordova_file_file.md.html#FileReader

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM