是否有可能获得应用程序的情况下在Android图书馆计划? [英] Is it possible to get application's context in an Android Library Project?
问题描述
我想获得应用程序,它具有一定的参考上下文/承载我的图书馆在运行时,一个班我的媒体库的项目中。可能吗?如果是的话,怎么办?
感谢
更新 我不希望我的用户通过上下文参数,以我的图书馆项目,因为它可能是我的库项目将通过JNI调用,我不知道我怎样才能上下文JNI,并把它传递到Java层。
这可能吗?
是的。
如果是,如何?
在将它作为一个参数。
我不希望我的用户通过上下文参数,以我的图书馆项目,因为它可能是我的库项目将通过JNI调用,我不知道我怎样才能上下文JNI,并把它传递到Java层
然后搞清楚怎么[你]可以获得上下文JNI,并把它传递到Java层。我猜想,你会通过它像任何其他对象。作为@Blundell指出,你真的没有任何其他选择。
I would like to get the context of application which has reference/hosted my library at run-time inside one class of my library project. Is it possible? If yes, how?
Thanks
Update I don't want my user to pass context in parameter to my library project because it is possible that my library project will be called through JNI and I have no idea how I can get context in JNI and pass it to Java layer.
Is it possible?
Yes.
If yes, how?
Pass it in as a parameter.
I don't want my user to pass context in parameter to my library project because it is possible that my library project will be called through JNI and I have no idea how I can get context in JNI and pass it to Java layer.
Then figure out "how [you] can get context in JNI and pass it to Java layer". I would imagine that you would pass it like any other object. As @Blundell noted, you do not really have any other option.
这篇关于是否有可能获得应用程序的情况下在Android图书馆计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!