APP FUNDAMENTAL CONCEPTS
Before creating an android application using Eclipse, let us see some of the key terms involved while developing an application.
Key terms involved are:
1. Activity: An activity provides a user interface for a single screen in your application. The window typically fills the screen, but may be smaller than the screen and float on top of other windows. An application usually consists of multiple activities that are loosely bound to each other.
The various folders/files available in an eclipse project that are important in android development are:
- Android Manifest.xml
- Configuration files
2. src (Source Code) – This is where the Java source code is placed. The Java files are organized into packages that directly map to the folder structure. For eg: src/com.example.hello/Hello.java.
3. gen – Android tools generate code to map resources into the Java code. This generated code is placed in this folder. This folder contains R.java file which is generated after building any android application project. This particularly powerful with the code-completion features of IDEs like Eclipse because it lets you quickly and interactively locate the specific reference you are looking for. Additionally you gain compile-time safety that the resource you want to use really exists.
4. assets – The assets folder is empty by default. This folder is used to store raw asset files. A raw asset file could be one of many assets you may need for the application to work. For example, A file that contains data in a proprietary format for consumption on the device. Android has Asset Manager which can return all the assets currently in the assets directory. If you were to create an application that had its own dictionary for word look-ups, you may want to bundle this dictionary into the project by placing the dictionary file in the assets directory.
5. lib – This folder contains library files in case of multimedia, user info and location apps, etc.,
6. res – This folder contains all the resources required like images, layouts and values. Resources are external files(non-code files) that are used by your code and compiled into your application at build time. Android Supports a number of different kinds of resources files, including XML,PNG and JPEG files. The XML files have very different formats depending on what they describe. Resources are externalized from source code, and XML files are compiled into a binary, fast loading format for efficiency reasons. Strings are compressed into a more efficient storage form.
List of Resources:
Rescource-types and where to place them:
layout-files ————> “/res/layout/”
styles, strings and arrays —> “/res/values/”
Names do not have to be exactly like:
- ‘arrays.xml’ to define arrays
- ‘colors.xml’ to define colors (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
- ‘dimens.xml’ to define dimensions
- ‘strings.xml’ to define strings
- ‘styles.xml’ to define objects
- raw files like mp3 or videos ———–>”/res/raw/”
7. Configuration Files – This file helps you identify the default properties of the Android project (such as Android Version). It contains project settings such as build target. This file is integral to the project. The configuration files available are proguard-project.txt and project.properties.
Click Here To Share This..!!