I am just starting off with android and have been googling high and low to find any tutorials/resources that could answer my beginners questions.
How can import a third party resource into my project and start using it?
For example, i wanted to use scrollableTabActivity, a widget that's available at https://github.com/honcheng/ScrollableTabHost-for-Android. I have downloaded and it looks like it is a project by itself. How can import into into my project and start using it?
This is the case of even projects like droid fu, for the life of me i could not figure out how to add them and start using in my project.
I did successfully added asynchttp into my project cause there was .jar download available. But for projects like droid-fu or scrollableTabActivity, how can i use the source files to add the functionality into my project?
Any help is highly appreciated
Thanks
Add the projectyou downloaded to you workspace.
Right click on it, properties, Android and be sure the Is Library checkbox is checked.
Then in your project, right click, properties, Android and click on add on the bottom right to add the previous project.
The project you refer to actually contains a lot of demonstration code which shows you how to use the ScrollTabHost control in your app. Rather than trying to include this stuff which will just bloat your app, simply copy the ScrollTabHost.java file in to your project, along with any resources upon which it depends.
I agree with Mark Allison's answer. But generally speaking to import a whole project in Eclipse, check the box next to that third party project name on the Project References tab in your project Properties.
Related
I have already created an phonegap android project and it is working fine, now i would like to create same kind of project againg. Might it would be more than 5 apps, so i thought making it as library.
I have make the project as library and created a new project with different package name. Change the launcher activities name to the libraries launcher activity name. But now the issue is application error is happening, cannot load the index.html file.
So i think the way worked on is not the proper one, can anyone please help me to solve this problem.
you have to assign your initial android project as a library. right click the project, pick properties, then go to android, tick the "is library" box and apply
For your new projects, you need to "add" the project before as your library as the image above
When I use the command 'Quick Documentation' in Android Studio in a class that comes from one of the support libraries (e.g. ActionBarActivity), the IDE does not show the documentation for the class. If I use it on one of the classes from, say, the Android API 19 (e.g. Activity), the IDE displays the complete documentation as is shown in the reference page on https://developer.android.com/reference/packages.html.
Is there any way to add the documentation for the support libraries to Android Studio so that they can be accessed through 'Quick Documentation' as well?
When Android Studio has opened the decompiled jar class, click on "Download..." blue link at top right, this will download jar with javadoc and save it in :
/.ideaLibSources
rebuild project if necessary, now doc is available.
Tested on android studio 2.0 preview 4.
If you are not using Gradle, this will be easier for you.
Go to File -> Project Structure. From there, on the left-hand side, select Libraries. Select the library you want to add source/java-docs to, then click the plus at the bottom and add the source and/or java-doc jars. There's a chance AS will automatically know what's what.
If you're using Gradle, more than likely in Project Structure, you won't see the Libraries tab, and I'm sorry but I don't know how to help from that point. If you use Gradle, AS detects that and takes away "unnecessary" options. Sorry to send you searching again, but I know there's something called a .properties file for jars that tell the source and java-docs, but I haven't implemented it. If I can find the page that told me that information, I'll update this.
EDIT: The answer is here. This should help you out.
I'm having a real bad time trying to get Licensing to work. I'm following the docs at this location. I built the LVL library from the existing code in the Google Play Licensing Library and put the library into my workspace along with my android project.
I'm using code from this example that packages the licensing logic into a separate activity but I believe this is moot to the problem I'm having as I have tried it from my own main activity too.
THE PROBLEM IS: I cannot import com.android.vending.licensing...
The graphic below illustrates the problem. Internet research on this issue turns up many developers having this and related problems but none of the solutions work for me.
Does anyone have a clue?
Right click on LVLibrary -> Properties -> Android
Check if isLibrary is selected (checked)
THen go into your com.deanblake... and right click on that, then same as above but where you see reference check if the libarary is added (doesnt have an x next to it). If not just click Add and select LVLibrary.
I have two independently developed Android projects (with own activities etc.), tested and working independently.
One project is now supposed to be launching (via Intent) the second project.
I could have kept it that way, but when distributing it via the Android Market, it will necessitate 2 APKs, 2 icons, etc. which could be very confusing to the end user.
So I would like to integrate the second project into the first one, while keeping it as a separate package.
A straightforward approach for doing this is to manually create an empty package, then copy over all files, one by one, from the second project. Tedious.
Is there a built-in shortcut in Eclipse (or ADT) to do this, similar to the File > Import > Existing Projects into Workspace ?
I think you can make your second project as a Library Project by right clicking on it and in the Android tab check isLibrary. And then in your first project, you link the one that you made a library by right clicking again and under the Android tab, Libraries, click Add and point to your Library Project. You could also have a look at Managing Projects from Eclipse.
If this does not work (but I really should), you can simply just right click on your packages, then select Copy and go to your first project, and just right click -> Paste. This also worked for me.
I am trying to add the LVL library project to my application's project. It should be simple and straightforward, but it isn't:
When I click the Add... button, I receive the Library Project Selection dialog as expected:
I select it and it is being accepted with the green checkmark next to it.
However, when I re-open that Properties > Android box again, it gets a red X next to it, making it unusable:
There is an excellent answer documenting the "delicate behavior" of referencing a library project, but despite implementing the tips there (same root directory), I am still having this problem.
How do I solve (or workaround) this problem?
Is there a way to make Eclipse/ADT use fewer..\..s to represent the path of the referenced library project? (all is needed to reference that library correctly is ..\..\thisisinsane\library, there really is no need for all that ..\..\..\..\..\..)
I solved the problem by following the excellent steps in this answer.
In essence, The Eclipse+ADT duo doesn't "like" projects that aren't in the workspace, regardless whether these are application projects or library projects (even if Google created them).