开发者

Is it possible to read/edit shared preferences in native code?

I have an Android app that includes a C library using NDK to execute some some code. Within the C library I would like to update the applications shared preferences. My question... is it possible to read/edit开发者_如何转开发 shared preferences in native code?


You can do anything you want in native code. It's just cumbersome - you need the JNIEnv object to first find the class ID, then the method ID, if you have any non-primitive types, you need to create those too. But then you just call the method, and you're done.

JNI Docs - look for FindClass, GetMethodId, CallVoidMethod, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜