Welcome to Android 101 - Goofing around part II. Let's sink our teeth into the structure of an Android Project in Eclipse environment. First of all it should look like this if you followed the procedure in "Android Programming - Goofing around I".
Well I should mention something, you saw that unlike a JAVA project, you can't just give a project name and create a project. You had to go through a lot to create the first project.
But Android and JAVA both share very much in common. In fact, Android API uses almost all JAVA libraries other than it's native libraries.
Let's take a tour through the Project hierarchy. In fact that's our lesson for today.
First you have the package you created. This is your closet for this project. All the handy classes you create goes there. Well for the first project you won't be needing to create new classes. When you specify the package name, Eclipse automatically creates the main class. It's inside the "Red Square #1". Hey why not take a look at it.....?
Now below you have the "gen" folder. Android uses this to maintain a auto-generated .java file (Red Square #2) (R.java). You can access the layout or widgets you create through this R.java file. Don't mess with this file.
Then you've got "res" folder. It's got 2 vital xml files we need to have some knowledge of. Main.xml and String.xml .
Main.xml file you can specify the interface of your app. It works similar to Netbeans. If you can't figure out don't worry. We'll get to that later. (Red Square #3)
String.xml we can store various strings for various purposes. (Ex: myButtonClickHandler, Button names, ...) (Red Square #4)
Then the AndroidManifest.xml is important too. But you don't have to have a profound knowledge about that file. Skip it for the moment.
That's all for now folks.
No comments:
Post a Comment