I'm a total newbie to Android app development, so do excuse the lengthy explanation. Anyways, I have already developed my application (running successfully). Now, I want to integrate an open source app (quiz) into my application. So, when user presses a button in my app, it will then run the quiz application.
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. 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. Plus, the .jar file is also checked under the 'Order and Export' tab.
Now, I have a problem with integrating the .jar file into one of my button (so that the quiz app runs when I press the button, as mentioned earlier). 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? I'm using 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.
That will be insufficient, in all likelihood. A JAR file only contains code, not Android resources, and the other app probably has some resources.
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.
The answers on that question have been out of date for over a year. Just add JARs to your project's libs/
directory, and do not modify the build path manually.
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?
It is "wrong all-together".
If the concept is wrong, how do I integrate the quiz app into my app?
Personally, I would recommend against doing it in the first place, if you are "a total newbie to Android app development". I would recommend that you spend more time getting familiar with Android first.
If you insist upon doing this:
Step #0: Undo everything you did so far (e.g., putting the JAR in your project)
Step #1: Do one of the following:
Copy all of the Java source code and all of the resources from the other project into your own, or
Convert the open source project into an Android library project, then attach that Android library project to your own app's project
Step #2: Add relevant entries from the other project's manifest into your own app's manifest, such as <activity>
elements and <uses-permission>
elements.
Step #3: As needed, such as from your proposed button click, call startActivity()
to start up an activity from the other project, rather than starting up one of your own projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With