Category : Blog
The Structure of an Android Appn is fairly immutably defined. In order for things to work properly, you need to put keep positive files in the right places. At the end of this chapter, we also consider how basic app and screen exploration works on Android devices.
Packages in Java
Packages in Java are actually just folders where your classes can be stored. This allows you to write code that has a well-organized structure where classes that are similar can be in the same package and be named in a meaningful way that announce their purpose.
You’ve already used packages before in Java, perhaps without accomplishing it, because it’s almost hopeless to write a meaningful application that doesn’t use classes in different packages. For example, Java defines a top-level package named java, and indoors it are packages such as lang, which contains core classes like String, and util, which contains compilation classes like ArrayList. Similarly, the Android API provides a top-level android package that enclose packages named graphics, view, widget, and many more.
If you wanted to use the ArrayList class in your code, you would have to refer to it using its fully-qualified name that combine its entire package path: java.util.ArrayList. Fortunately, the Java language curtail the amount of typing that you have to do by providing the bearing statement. If you write the following:
then calligraphy ArrayList by itself would refer to the class in the java.util package.
Another advantage of using packages in Java is that you can have multiple classes with the same name as long as they are in different packages and they will not competition. This becomes decisive when you write code that uses a lot of third-party libraries where the anticipation is high that study would have classes with the same names.
How Android Uses Packages
Android uses packages not only to arrange the code in an application but to manage the utilization themselves. The Android OS requires that every app installed on a device have a package accessory that is at least two levels deep. In other words, a package named mycoolapp would not be applicable, but one named my company.mycoolapp would be acceptable. Then, the main package that contains an app’s code is used to entirely identify that application on the device, and to allowance apps to communicate and share information with each other.
- 6 Reasons to Learn Android Development
- Why Do We need to Take up Android Training
- Android vs iOS Development: Which Platform is Better?
Android Project File Structure
Android projects in Eclipse (or even in general, when using other advancement tools), have a pre-defined structure with code and resource coordinated into a number of folders.
Contains source code that is autogenerated by the Android development tools that is
compulsory for your app. Do not customize any of the source files in this folder—your changes will be overwritten the next time you build your project anyway.
Contains precompiled third-party libraries that you want to use in your app. For example, if you were handwriting an app that drag data from Twitter feeds, you would want to use a Twitter library that character has before written for you, and you would put it in this folder.
Contains other folders with belongings for your application: GUI layouts, icons, menus, and so forward.
Contains other media that you might want to use in your app, such as videos, sounds, and large presentation that are not used directly in GUI layouts.
As briefly mentioned above, the res folder of your project stores a variety of resources that your application needs to current itself to the user. These resources are gathered in folders inside the res folder, depending on the type of the resource:
Contains XML files that characterize menus that are correlate with screens in your application, which the user can make come out by clicking the Menu button on his or her device.
Contains images used in assorted parts of the application: launch screen icons, images add to buttons or menus, and so forth.
Android projects can actually have multiple drawable folders that are named after the agreement of the device. For example, drawable-ldpi would accommodate images used on low resolution devices, drawable-hdpi would contain images used on high resolution devices, and so forth. This allows an app developer to create images designed doubtless for different sized screens that look crisp and clear without any mount .
Contains XML files that define the layout of the widgets on the screens in your application. Fortunately you typically do not need to write any XML directly – the Android tools in Eclipse provide a drag-and-drop editor for laying out your screens.
Contains “values” used completely the application, such as text strings and style definitions. The main use of this is the strings.xml file, which can be used to store the text cord used in your GUI layouts . It makes your application accessible to translate into other languages because you have all of the strings stored conveniently in one place and you only need to have that single file translated.
Navigation on an Android Device
Navigation between apps and other features on Android phones is mostly consistent across devices, regardless of the form factor or manufacturer of that device. Google has put in place a set of advised, and sometimes required, controls by which the user can cross on the device.
The latest versions of the Android operating system crave that devices have Home and Back buttons to backing navigation among screens and apps. If you hover over the picture of the phone to the right, you will see allocation of the interface highlighted that you can then hover over to see a description.
Pursuing to know the interest if useless, until and unless you don’t have the best place to drip in for training.
So, Here we have select the best place for Android Training in Chandigarh for you. You may visit CBitss Technologies and have the best training for Android Development.