FileDocCategorySizeDatePackage
JniLibTest.javaAPI DocAndroid 1.5 API2038Wed May 06 22:42:02 BST 2009com.android.unit_tests

JniLibTest

public class JniLibTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
private static native intnativeStaticThing(float f)

private native voidnativeThing(int val)

protected voidsetUp()

        super.setUp();
        /*
         * This causes the native shared library to be loaded when the
         * class is first used.  The library is only loaded once, even if
         * multiple classes include this line.
         *
         * The library must be in java.library.path, which is derived from
         * LD_LIBRARY_PATH.  The actual library name searched for will be
         * "libjni_lib_test.so" under Linux, but may be different on other
         * platforms.
         */
        try {
            System.loadLibrary("jni_lib_test");
        } catch (UnsatisfiedLinkError ule) {
            Log.e("JniLibTest", "WARNING: Could not load jni_lib_test natives");
        }
    
public voidtestNativeCall()

        Log.i("JniLibTest", "JNI search path is "
                + System.getProperty("java.library.path"));
        Log.i("JniLibTest", "'jni_lib_test' becomes '"
                + System.mapLibraryName("jni_lib_test") + "'");

        int result = nativeStaticThing(1234.5f);
        nativeThing(result);