Add:android:More flexibility in choosing the data directory
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 31 Aug 2011 08:13:25 +0000 (08:13 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 31 Aug 2011 08:13:25 +0000 (08:13 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4729 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/android.c
navit/navit/android/src/org/navitproject/navit/Navit.java

index 556b670..fb0a87a 100644 (file)
@@ -51,9 +51,9 @@ android_find_method(jclass class, char *name, char *args, jmethodID *ret)
 }
 
 JNIEXPORT void JNICALL
-Java_org_navitproject_navit_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string)
+Java_org_navitproject_navit_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string, jobject path)
 {
-       char *strings[]={"/data/data/org.navitproject.navit/bin/navit",NULL};
+       char *strings[]={NULL,NULL};
        const char *langstr;
        const char *displaydensitystr;
        android_version=version;
@@ -71,7 +71,10 @@ Java_org_navitproject_navit_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject
        dbg(0,"*****displaydensity=%s\n",displaydensitystr);
        setenv("ANDROID_DENSITY",displaydensitystr,1);
        (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr);
+       strings[0]=(*env)->GetStringUTFChars(env, path, NULL);
        main_real(1, strings);
+       (*env)->ReleaseStringUTFChars(env, path, strings[0]);
+       
 }
 
 JNIEXPORT void JNICALL
index a6e2bb0..cd3694a 100644 (file)
@@ -438,7 +438,7 @@ public class Navit extends Activity implements Handler.Callback
                // --> dont use!! NavitMain(this, langu, android.os.Build.VERSION.SDK_INT);\r
                Log.e("Navit", "android.os.Build.VERSION.SDK_INT="\r
                                + Integer.valueOf(android.os.Build.VERSION.SDK));\r
-               NavitMain(this, langu, Integer.valueOf(android.os.Build.VERSION.SDK), my_display_density);\r
+               NavitMain(this, langu, Integer.valueOf(android.os.Build.VERSION.SDK), my_display_density, NAVIT_DATA_DIR+"/bin/navit");\r
                // CAUTION: don't use android.os.Build.VERSION.SDK_INT if <uses-sdk android:minSdkVersion="3" />\r
                // You will get exception on all devices with Android 1.5 and lower\r
                // because Build.VERSION.SDK_INT is since SDK 4 (Donut 1.6)\r