As a total Android development beginner, I might be asking a stupid question here, but I thought I'd go for it anyway, since I have no clue about what to do.
I want to have a carousel kind of menu on my MainActivity for the app I'm trying to develop. I found this project after some searching : http://www.codeproject.com/Articles/146145/Android-3D-Carousel
It's exactly the kind of carousel I want to put in my app, but I'm not sure whether I should import parts of the project containing the carousel (which is a demo of it, available to download) so I can use the same type of carousel in the MainActivity of my own app, or if it's a totally wrong way of thinking.
I think I've also figured that Android libraries are .jar files, and this carousel is a project, not a .jar, so I don't know if there is a way to get this kind of component inside my app.
I tried some dirty copying and adapting from one project into another, but I'm so new with even the basic structure of an Android app that I couldn't make anything out of it.
Any help or guidelines would be greatly appreciated.
I'm planning to make a menu out of this kind of component, and couldn't find anything else closer to what I'm trying to do, for Android.
EDIT : I'm working on Eclipse
Stick the visual language of Android, Holo. Pushing clunky GUI that looks out of place is the last thing this platform needs.
You may mark a project as a library when you create it. You can then import it to another project with Project Properties > Android > Add Library. This point answers you question the most, I guess.
I strongly suggest understanding basic widgets and classes first. Don't go onto the deep waters. If you want flashy slidy things, take a look at Fragment and FragmentPagerAdapterclasses. Plenty more examples that are free, to begin with. By using support library v4 and Android Sherlockbar you should get a better feel of the platform while keeping it up to day date and backward compatible.
Download the project, then go File->Import->Android->Existing Code into Workspace and you will have that project in workspace.
If you want to add only activity then create your own one, File->New->Other->Android->Android Activity and then copy the code and check method setContentView() if it have the layout you need. If you have MainActivity activity with layout called activity_main (which is default) then just check if you have setContentView(R.layout.activity_main);.
Related
I have a project that I have been working on which is a standard android application that does not include any other external libraries at this time. I am now looking at making a game at the end of the app(its a quiz so after the questions I want to make a mini game).
So what I am trying to find out is can I just import the libraries that it uses and connect them to my project rather than creating a LibGDX project and importing that?
What it comes down to is your personal preference. In answer to your question, yes you could just add in the jar files and such into your current project, however you are going to have to edit your manifest and some add in some other stuff besides jars using this Setup. In my personal opinion it would be easier to create a libgdx project using the tutorial found here, but in the end as I said before it all depends on what exactly you want to do.
Before deciding, ask yourself.
Do I want to have everything in one project, or can it be in more than one?
What would be better in the long run for managing my app.
Do I want ease now or later?
Cheers!
According to this link www.androidbootstrap.com/ I am wondering what does it really do, what is for? Am I supposed to use it?
I've read all text on this main page but I am still confused and I do not know should I use it.
The main problem is I don't see the point. Could someone tell me what is it for?
I am open for new technologies but here is the example where I don't understand, but they say that using their package will shorten my work on application.
Regards and I am looking for any information.
I am wondering what does it really do
It generates a skeleton Android project containing specific libraries. It is reminiscent of the new-project wizard in Eclipse, just supporting more third-party libraries, particularly ones that may be a bit of a challenge to get working together.
I had a look at this project to provide a quick set up for actionbarsherlock and dagger DI.
I think it’s a good idea as it seeks to provide an android template, with an out the box solution including sherlock and dagger. But I couldn’t get it working on eclipse, and the forum had a lot of people saying the same (I think its designed for Intelij IDEA)
I also looked at androidkickstartr which is more mature, but again had import issues, so just made my own template and imported sherlock and dagger
What would be the right way of including smaller android apps, into one bigger if requirements are the following:
little apps should be loosely coupled and should be developed separately
bigger app should handle some common things, instead of each little app do it for itself.
bigger app should now something about state of little apps, in order to do some decisions.
First thing that comes into my mind is some sort of plug-in pattern (although I don't know much about it, so I could say something wrong), so that each little app should implement some common interface, and big app should use that interface when dealing with component.
Is that right approach?
Is this right way of thinking considering android as a platform?
Your best bet is to make each sub app a "library." You create a workspace in Eclipse and create a new Android project and mark it as a Library.
You do that for each sub app.
You then have a non-library application that imports each library and uses each as part of the full application.
This means you don't need to worry about writing a plugin interface, etc.
Also if you follow this sort of pattern, when you create a free vs paid application, you are able to just add another application and remove / change functionality as that one all needs and compile both from the same code base.
Update
Take a look at http://developer.android.com/tools/projects/projects-eclipse.html for some decent documentation.
This shows how to create both types of projects and how to reference them in your manifest which is the annoying part.
Update2
From comments it was asked if you can use a library Activity in a main application that imports the library.
You create an Activity in the library
com.example.myapp.library.MyActivity
Then you add details to your manifest
<activity name="com.example.myapp.library.MyActivity">
This then let's you use it there. You can even use a library Activity as your main startup Activity if that's what you need.
You can also extend a library Activity by changing your manifest to
<activity name="MyNewActivity">
Then create a new activity
class MyNewActivity extends com.example.myapp.library.MyActivity
Then just override what you want, call super to access your library method if desired, etc.
Feel free to ask questions.
I am very new to eclipse and android developing in general and need help with the following. I have built two android projects in Eclipse with the android SDK:
"ORF401 Project" - targets Android 2.2 platform
"Map Project" - targets Google APIs 2.2 platform
I have followed the steps as specified by the standard Hello World Google Maps for android tutorial and have gotten the Google map to display on the emulator when I run the second project.
I have a menu set up in the 1st project for which one of the options is to load the map. However, I'm not sure how to load the map within this project since only one build target can be specified for each project, and so I cannot specify the Google Maps API as a (additional) build target. Is there a way to call the main .java class from the second project within the first project? I see where a reference can be made to the 2nd project under the project properties, but I'm not sure how to make use of this. One possible solution I found on the web was to add the following code under the switch case in the first project:
Intent intent = new Intent(this, {googleMap}.class);
startActivity(intent);
I presume this would require an additional googleMap.java class in the first project and also another activity, but I can't get it to work. Can anyone make a suggestion as to how I can accomplish this?
If the code for either or both projects would help, I'll be happy to post it. Thanks
The main idea with projects is to have one project per application that does some thing.
I assume your application needs to do something with maps, as well as something else. There is no need to split those ideas. Keep them in one project, because they make up one single application that you develop.
First thing I would suggest - read carefully about activities and intents. Head to http://developer.android.com - everything's clearly explained.
With that all cleared up you will see the point in making some button, which, being tapped, opens a new screen with the map feature that you've developed. And then let's you go back or do something else, like open a new screen, a browser, etc.
And give up trying to call the other project from a different one :) It's not the way I think you want to do stuff.
Just to make sure I'm not misunderstood - of course you might want to have two projects. But those will most probably result in two separate applications. Luckily, applications may also interact by intents, or content providers, or a couple more. Just see how Contacts app takes you to GMail app if you want to send a mail. If that's what you want to achieve - still need to read about intents.
edit:
Here's the link I mentioned about in the comments:
http://android-developers.blogspot.com/2010/07/how-to-have-your-cupcake-and-eat-it-too.html
It explains how to achieve the 'additional target' that you would like to have.
There are ways to call a class from one project in another project, but there are bigger problems here. The first project can run on any Android device. The second, however, requires Google Maps APIs. You won't be able to invoke it anyway, because it can't be installed unless you're in an environment that supports Google APIs. There really is no benefit to doing this, unless you have additional functionality in project 1 such that it can exist without project 2.
I would suggest using the Intent method rather than trying to hack something together that allows you to access another class. Regardless, though coupling these two together like this seems overly complicated and error prone. I would suggest simply embedding the mapping functionality in project 1 and requiring Google APIs. Most mainstream device support them anyway.
If you're married to the idea of having two separate projects with different build targets, I would suggest looking into using BroadcastReceivers with a custom intent that you broadcast from application 1. I don't believe startActivity will work across application boundaries because of class loader issues, but I could be wrong about that.
I'm attempting to use a custom Android vertical scrollbar widget that seems to work fine in its own example project, but I am having trouble trying to include it into my project. I've exported a .jar from it to use in my project, but it seems to be a minefield of problems, from duplicate resources, to my XML layouts not able to get at styles inside the library, and errors "inflating class" when reading my XML layout file.
How should I go about using the widget from another project in my own?
Quite new to Java development (know the language, but not much of the overarching project/package management), so if there's some good text regarding that it would be appreciated.
Create an Android Library Project for the widget.
As far as I can understand the problem should be related to the "R" class which is created in the same package as the main activity. When you create the new project this class is located in "the wrong place".
Giving up compatibility and require the use of the same package in all projects is not an option: market will not allow you to publish more than one application per namespace. Moreover, is is not a good practice for software engineering.
A much better solution is, as already pointed out by fhucho, to create a library project with your widget to be imported in the main application project.
If you are also looking for a book on android development and already know java I usually recommend "Hello Android" by Ed Burnette, it is quick to read but gives a nice overview with examples.