Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Day 2: Structure of Android Application Project
WhatsApp
Abhishek Kumar Ravi
4y
13k
0
1
100
Article
Introduction
We saw a number of files and folders in Package Explorer.
So in this article, we will talk about the various files and folders of an Android Project and what they mean actually.
Agenda
src
gen
assets
bin
res
layouts
menus
values
AndroidManiefest.xml
Content
src:
It contains the Java source file of your project.
Since every Android project needs a Java file because an Activity needs an XML layout, that is a front end of activity and Java file, that is a back end.
By the front end, I mean the User Interface (UI) of your activity and in the back end, we define the behavior of UI views.
Analogous: Like in WPF or any Silverlight project, we need a XAML file in the front end (describes the UI) and C# file (.cs) file in the back end to define the behavior of the controls.
gen:
It contains an R.java file that manages all the resources.
It is a compiler-generated file that references all the resources in your project. Most of the time you are asked to avoid modification in an R.java file. So, we do.
Basically, this file is the only way to link an src/java file to an XML layout file.
Since we have multiple views (controls) in our XML file. How does the src/java file know about these resources?
So, R.java maintains a list of resource IDs so that we can further access these resources from a Java file.
assets:
It contains all the assets like database, HTML file, text file.
bin:
This file contains the built file, in other words, the APK file is a binary application of the Android project.
res:
This folder contains the drawable file. Simply, all the image files are stored in this folder under the respective resolution.
layouts:
Contains all the XML layouts files.
Generally, an Android app has a number of activities and each is linked up with an XML layout file. Those layout files are stored in this folder.
In our project, we have a single XML layout file, in other words, activity_main.xml is linked with MainActivity.java.
Another is a fragment file that we will ignore for this discussion.
menu:
This folder stores the XML file that defines the menu.
Most of the interesting apps have an application menu and they are all defined inside the menu folder as XML files.
values:
This stores the strings.xml and styles.xml file.
Assume you have your app in English and the next day you want to upgrade your app to be in the French language. Then, you need to modify every text or just modify your string file.
So it's better to modify the string.xml file than manage every text fields.
AndroidManifest.xml:
It is a meta-data file like any other meta file that stores information about activity and kind of permission required by the application.
Conclusion
In the next article, we will try to do Navigation of Activity from one to another.
Previous article:
Day 1: Make Your Setup Ready for Android App Development
Next article:
Day 3: Navigation Between Activities in Android Project
Android Application
Bin
SRC
Structure of Android Application
Up Next
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found