Android Application Development
Development Platform Architecture
Android is an open source, Linux-based software stack created for a wide array of devices and form factors. The following diagram shows the major components of the Android platform.
Feature of Android Studio:
Installing The Android ADT (Android Development Tools)
- Android is an open-source platform that allows you to develop customized applications.
- The tools needed for their development are free of cost, and there is no need to purchase an extensive developer phone or register your hardware as a development device.
- The Popular Tools in 2022 that used in Android Development is Following as;
1. Android Studio
2. Eclipse
What is SDK?
The Android SDK (Software Development Kit) is a set of Development Tools that are used to Develop Application for the Android Platform. Android SDK stands for Android Software Development Kit which is developed by Google for Android Platform. With the help of Android SDK, we can create android Apps easily.
Installing the Android SDK (Software Development Kit)
Within Android Studio, you can install the Android 12 SDK as follows:
- Click Tools > SDK Manager.
- In the SDK Platforms tab, select Android 12.
- In the SDK Tools tab, select Android SDK Build-Tools 31.
- Click OK to install the SDK.
Android Virtual Devices
AVD is used for Test the application in the System. In this purpose the Android Emulator is used to create the virtual Devices. You can create more than one AVDs in order to test your applications with several different configurations.
Android Virtual Device (AVD) is a configuration that defines the characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive OS device that you want to simulate in the Android Emulator. The Device Manager is an interface you can launch from Android Studio that helps you create and manage AVDs. Creating AVDs (Android Virtual Devices)
For Creating AVDs Follow the Link
Visit to Create AVDWhat is Activity in Android Application?
Activity is the Screen we see in the application. We have move from one activity to other activity. The end user not know about how they work, when the click on the button the new activity(screen) is open. An activity that in create has follow the activity life cycle.
Activity Life Cycle
- As a user navigates through the app, Activity instances in your app transition through different stages in their life-cycle.
- The Activity class provides a number of callbacks that allow the activity to know that a state has changed:
- that the system is creating, stopping, or resuming an activity, or destroying the process in which the activity resides.
Activity Life Cycle Diagram
Life Cycle Methods and Callbacks
In general, activity lifecycle has seven callback methods:
- onCreate ()
- onStart ()
- onResume ()
- onPause ()
- onStop ()
- onRestart ()
- onDestroy ()
onCreate (): In this state, the activity is created.
onStart (): This callback method is called when the activity becomes visible to the user.
onResume (): The activity is in the foreground and the user can interact with it.
onPause (): Activity is partially obscured by another activity. Another activity that’s in the foreground is semi-transparent.
onStop (): The activity is completely hidden and not visible to the user.
onRestart (): From the Stopped state, the activity either comes back to interact with the user or the activity is finished running and goes away. If the activity comes back, the system invokes onRestart ()
onDestroy (): Activity is destroyed and removed from the memory.
Views:
A view is considered as a basic building block for a proper user interface that is created from the view class. View is the small rectangular box in the android development which response to the user inputs such as button, edit text, image views, checkbox and so on.
What is difference b/w Views & Views Groups?
Views are in the rectangle shape (Text view, Image view, button and so on) all views are present in the parent Views Group that name is View Group.
View Group can store multiple views and itself, but the view like button, Edit Text view cannot store other views in himself.
Layouts:
A layout defines the structure for a user interface in your app, such as in an activity. In Android Studio Different types of layouts is present, but the layout contains the view groups, views in the activity. Layout help you to place the views in the activity in own location.
You can declare a layout in two ways:
- Declare UI elements in XML
Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts. - You can also use Android Studio's Layout Editor to build your XML layout using a drag-and-drop interface.
- Instantiate layout Elements at Runtime
Your app can create View and ViewGroup objects (and manipulate their properties) programmatically.
Types of Layouts in the Android Studio
Now that we’ve learned about the view and view groups and also somewhat about the layouts. Subsequently let us see the types of Layouts in Android, that are as follows:
- Linear Layout
- Relative Layout
- Constraint Layout
- Table Layout
- Frame Layout
- List View
- Grid View
- Absolute Layout
- WebView
- Scroll View
Linear Layout
LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. It creates a scrollbar if the length of the window exceeds the length of the screen.
Relative Layout
RelativeLayout is a view group that displays child views in relative positions. Enables you to specify the location of child objects relative to each other (child A to the left of child B) or to the parent (aligned to the top of the parent).
Constraint Layout
ConstraintLayout is similar to that of other View Groups which we have seen in Android such as RelativeLayout, LinearLayout, and many more.
Table Layout
TableLayout is a view that groups views into rows and columns.
Frame Layout
The Frame Layout is a placeholder on screen that you can use to display a single view.
List View
List View is a view group that displays a list of scrollable items. Displays a scrolling single column list.
Grid View
Grid View is a ViewGroup that displays items in a two-dimensional, scrollable grid. Displays a scrolling grid of columns and rows.
Absolute Layout
AbsoluteLayout enables you to specify the exact location of its children.
Web View
Displays web pages in the Android Application.
Scroll View
Attributes of Layout in Android
The following are the attributes for customizing a Layout while defining it:
- android:id: It uniquely identifies the Android Layout .
- android:hint: It shows the hint of what to fill inside the EditText.
- android:layout_height: It sets the height of the layout.
- android:layout_width: It sets the width of the layout.
- android:layout_gravity: It sets the position of the child view.
- android:layout_marginTop: It sets the margin of the from the top of the layout.
- android:layout_marginBottom: It sets the margin of the from the bottom of the layout.
- android:layout_marginLeft: It sets the margin of the from the left of the layout.
- android:layout_marginRight: It sets the margin of the from the right of the layout.
- android:layout_x: It specifies the x coordinates of the layout.
- android:layout_y: It specifies the y coordinates of the layout.
Cover Topics
"Android Application Development","android studio notes","what is activity life cycle","layouts in android studio","types of layout in andoird studio"
إرسال تعليق
To be published, comments must be reviewed by the administrator.