Passing a string to C-code in Android NDK

Viewed 11820

The program should take an Image from the SD card and adjust its brightness. And the image is taken from the SD card via the NDK C-code. It is to be noted that the string depicting the path to the image is passed to the NDK via JNI.

Java code:

private void adjustBrightness() {
   imagePath     = (Environment.getExternalStorageDirectory().getPath()+"earthglobe.jpeg").toCharArray();
   brightness(imagePath, brightness);
}

public native void brightness(char[] imagePath, float brightness);

NDK code:

JNIEXPORT void JNICALL Java_com_example_ImageActivity_brightness(JNIEnv * env,char[] bitmappath, jfloat brightnessValue)
{
   string bmpath    =   bitmappath+'\0';
   jobject  obj = fopen( bitmappath , "rb" );
}
1 Answers
Related