I have the C source code for a program that generates images based on parameters the user gives in a shell. It takes parameters and then generates a bitmap image and saves it to the local disk. I want to modify it so that I can call the image generation function from Java, and somehow get access to the bmp file that is generated.
How do I get access to the generated image file? Can the C program save to some sort of android local disk? Can I get the image file into a Java object in memory?
You can run a program using this class on Android. http://developer.android.com/reference/java/lang/Runtime.html
You want to use one of the version of Runtime.exec
. You'll need to compile your C program using the NDK and include it in your APK.
Android provides app private files hive, see http://developer.android.com/guide/topics/data/data-storage.html#filesInternal . You get its full path in Java as Context.getFilesDir() , and you can find this path from native code.
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.