android - 在我自己的应用程序中集成另一个 android 应用程序

标签 android jar integration apk

我是 Android 应用程序开发的新手,所以请原谅冗长的解释。无论如何,我已经开发了我的应用程序(成功运行)。现在,我想将一个开源应用程序(测验)集成到我的应用程序中。因此,当用户按下我的应用程序中的按钮时,它将运行测验应用程序。

我从here中学到了(Denys Nikolayenko 的回答)有一种方法可以将测验应用程序转换为 .jar 文件,并将其添加到我当前的项目中。我已经这样做了;如 here 所述,将 .jar 文件添加到构建路径(它出现在引用的库中) .此外,还会在“订购和导出”选项卡下检查 .jar 文件。

现在,我在将 .jar 文件集成到我的其中一个按钮时遇到了问题(以便在我按下按钮时运行测验应用程序,如前所述)。有没有办法将 .jar 文件集成到按钮中(我在任何地方都找不到任何示例代码)?或者这个执行 .jar 文件的概念是否完全错误?

如果概念有误,如何将测验应用程序集成到我的应用程序中?我正在使用 Eclipse。

最佳答案

I have learnt from here (answer by Denys Nikolayenko) that there is a way to do it by converting the quiz app into .jar file, and adding it into my current project.

这很可能是不够的。 JAR 文件只包含代码,不包含 Android 资源,其他应用可能有一些资源。

I have already done that; to the point of adding the .jar file to Build Path (and it appears in Referenced Libraries) as stated here.

那个问题的答案已经过时一年多了。只需将 JAR 添加到项目的 libs/目录,请勿手动修改构建路径。

Is there a way to integrate a .jar file in a button (I couldn't find any sample code anywhere)? Or is this concept of executing a .jar file wrong all-together?

这是“全错”。

If the concept is wrong, how do I integrate the quiz app into my app?

就个人而言,如果您是“Android 应用程序开发的新手”,我首先建议您不要这样做。我建议您先花更多时间熟悉 Android。

如果你坚持这样做:

第 0 步:撤消到目前为止所做的一切(例如,将 JAR 放入项目中)

第 1 步:执行以下操作之一:

第 2 步:将其他项目 list 中的相关条目添加到您自己应用的 list 中,例如 <activity>元素和 <uses-permission>元素。

第 3 步:根据需要,例如从您建议的按钮点击,调用 startActivity()从其他项目开始一项 Activity ,而不是开始您自己的项目之一。

关于android - 在我自己的应用程序中集成另一个 android 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16631057/

相关文章:

java - 如何使用 Cygwin 创建 jar 文件?

java - 如何静态分析jar包(map-reduce应用程序)并提取一些影响执行时间的功能?

C++ 蒙特卡洛积分 : How to run code multiple times without summing the results?

android - 如何在另一个 View 下添加动态按钮?

android - 如何获取布局相对于屏幕的位置

Heroku 上的 Java Spring MVC 错误 : Unable to access jarfile target/dependency/webapp-runner. jar

file - 在 CSV 文件中传输二进制数据(图像等)

python - 如何在 Python 中使用 dorpi5 或 dop853

android - 服务在 Activity 被销毁时停止

android - 为什么现在我不能做 android :id ="@+idLayouName/text"?