in my android application in need to access the shared memory between the 
two application ,i knew android kernel is not  like Linux kernel to 
implement the shared memory concept ,so i have choosen the shared 
preference in android but i need to implement this via JNI not in java part 
i have tried to create a shared preference in jni but i cant get it 
properly 
this my code

    JNIEXPORT jlong JNICALL Java_com_sharedpref1_test_savevalue
      (JNIEnv *env, jobject ctx, jstring store, jstring key, jlong value);
    
    
    
            jobject shared_preferences = (*env)->CallObjectMethod(env, ctx, 
(*env)->GetMethodID(env (*env)->FindClass(env, "android/content/Context"), 
"getSharedPreferences", 
"(L/java/lang/String;I)Landroid/content/SharedPreferences;"),
                    jstore,
                    1);
            jobject preferences_editor = (*env)->CallObjectMethod(env, 
shared_preferences, (*env)->GetMethodID(env,
                    (*env)->FindClass(env, 
"android/content/SharedPreferences"), "editor", 
"()Landroid/content/SharedPreferences$Editor;"));
    
            (*env)->CallObjectMethod(env, preferences_editor, 
(*env)->GetMethodID(env, 
                    (*env)->FindClass(env, 
"android/content/SharedPreferences/Editor"), "putLong", 
"(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;"),
                   jkey,
                    value);
    
        
    }

can any know how to done shared preference in jni on android.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to