Android Development Short-Notes | The Coders Notes

Android Development Short-Notes 


ANDROID : Android is a mobile operating system based on a modified version of the Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets. 

VERSIONS OF ANDROID :

 1. donut 

 2. eclair 

 3. froyo 

 4. gingerbread 

 5. honeycomb 

 6. icecreamsandwich 

 7. jelly beans 

 8. kitkat 

 9. lolipop 

 10. marshmellow 

 11. nought 

 12. oreo 

 13. pie 

 14. os10 


ANDROID ARCHITECTURE : 

  • Android architecture contains different number of components to support any android device needs. 
  • Android software contains an open-source Linux Kernel having collection of number of C/C++ libraries which are exposed through an application framework services. 

The main components of android architecture are following:- 

1) Applications : top layer - containing all applications like home, contact, gallary, camera 

2) Application Framework : content several imporatant classes to develop applications 

3) Android Runtime : Android Runtime environment is one of the most important part of Android. It contains components like core libraries and the Dalvik virtual machine(DVM) 

4) Platform Libraries : The Platform Libraries includes various C/C++ core libraries and Java based libraries such as Media, Graphics, Surface Manager, OpenGL etc. to provide a support for android development. 

5) Linux Kernel : this is like a heart of android architecture. it contains security, memory management, process managment, network stack, driver mode

SOFTWARE REQUIRED TO DEVELOP ANDROID APPLICATION : 

1. java jdk5 or jdk 6

2. android sdk 

3. eclips or android studio 

4. Android Developemer tools 

5. avd or android phone 


ANDROID DEVELOPER TOOLS - Android developer tools create intractive and powerful application 

1. SDK Tools : these are independent and no matter which android platform your working with 

2. Platform Tools : platform tools are customize to support the feacture of the letest android platform 

 LIST OF PLATFORM TOOLS : 

1. android debug bridge (ADB) : Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. 

2. Android Interface Defination language (AIDL) 

3. adpt, dexdump and dex et 

LIFECYCLE OF ANDORID APPLICATION :

 (.java file - java complier(javac) - .class file - dex comploer (dx) -.dex file - packaging adpt- .apk file)

DALVIK VARTUAL MACHINE (DVM) : 

the dalvik virtual machine is a register based varitual machine optimised for the mobile devices it optimize the virtual machine for meemory battrylife and performance 

ANDROID VIRTUAL DEVICE : 

An andrid virtual device is a configration that defines the charctics of an android phone tables, were os, android tv and automative os 

The AVD Manager is an interface you can launch from Android Studio that helps you create and manage AVDs 

EMULATOR : In computing, an emulator is hardware or software that enables one computer system (called the host) to behave like another computer system

 1) android emulator is a appliation that represents a virtual device 

 2) this provides all teh android applications in one device 

ANDROID MANIFEST : 

AndroidManifest.xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.   

ACTIVITY : 

An activity represents a single screen with a user interface. 

 For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails If an application has more than one activity, then one of them should be marked as the activity that is presented when the application is launched.

 ACTIVITY LIFE CYCLE : 

1. ACTIVITY LAUNCHED 

2. onCreate() : the activity enters in a create state. 

3. onStart() : this makes the activity visiable to user 

4. onResume() : called when activity will start interacting with the user. 

5. onPause() : called when activity is not visible to the user. 

6. onStop() : called when activity is no longer visible to the user. 

7. onDestroy() : called before the activity is destroyed.  

SERVICES : A Service is an application component that can perform longrunning operations in the background, and it does not provide a user interface. 

 Another application component can start a service, and it continues to run in the background even if the user switches to another application. 


TYPES OF SERVICES : 

 1) FORGROUND : A foreground service performs someoperation that is noticeable to the user. EX) playing audio track in forground 

 2) BACKGROUND : A background service performs an operation that isn't directly noticed by the user. ex) app used a service to compact its storage 

 3) BOUND : A service is bound when an application component binds to it by calling bindService().


SERVICES STATES : 

 1. STARTED : A service is started when an application component, such as an activity, starts it by calling startService(). 

 2. BOUND : A service is bound when an application component binds to it by calling bindService().


LIFE CYCLE OF SERVICES 

UNBOUND SERVICE //bound 

1) startService() : this is starts the sevice exrecuation //bindService() : A service is bound when another component 

2) onCreate() : The system invokes this method to perform one-time setup procedures when the service is initially created 

//onbind : The system invokes this method by calling bindService() when another component wants to bind with the service 

3) onStartCommand() : The system invokes this method by calling startService() when another component (such as an activity) requests that the service be started. If we implement this, we must call stopSelf() or stopService() to stop the service. 

//onUnbind : The system calls this method when all clients have disconnected from a particular interface published by the service. 

//onRebind() : The system calls this method when new clients have connected to the service, after it had previously been notified that all had disconnected in its onUnbind(Intent). 

4) onDestroy() : The system invokes this method when the service is no longer used and is being destroyed. 

CREATE A SERVCE :

1) startService(new Intent(getBaseContext(), MyService.class)); } 

 2) stopService(neW Intent(getBaseContext(), MyService.class)); 

TOAST : Toast is used to display information for a period of time. It contains a message to be displayed quickly and disappears after specified period of time. 

 Toast is a subclass of Object class. 

 Toast notification in android always appears near the bottom of the screen.

Toast.makeText(Context context, CharSequence text, int duration): This method is used to initiate the Toast. 

1. LENGTH_LONG : It is used to display the Toast for a long period of long time 

2. LENGTH_SHORT : It is used to display the Toast for short period of Short time  


BRODCAST RECIVER : 

• Android apps can send or receive broadcast messages from the Android system and other Android apps. 

 • These broadcasts are sent when an event of interest occurs. 

 • Broadcast Receivers simply respond to broadcast messages from other applications or from the system itself. 

 • For example, the Android system sends broadcasts when various system events occur, such as when the system boots up or the device starts charging. 

BRODCAST RECIVERS :

  •  android.intent.action.BATTERY_LOW : Indicates low battery condition on the device. 
  • android.intent.action.BOOT_COMPLETED : This is broadcast once, after the system has finished booting 
  • android.intent.action.CALL : To perform a call to someone specified by the data 
  • android.intent.action.DATE_CHANGED : The date has changed 
  • android.intent.action.REBOOT : Have the device reboot.
CONTENT PROVIDER : 
  • A Content Provider is used to store the data of applications.
  • A content provider is only required if you need to share data between multiple applications. i.e Content Provider component supplies data from one application to others on request. 
  • Such requests are handled by the methods oN the ContentResolver class. 
  •  A content provider can use different ways to store its data and the data can be stored in files, in a database or even over a network. CONTENT URI : The most important concept to understand when dealing with content providers is the content URI(Uniform Resource Identifiers). Whenever you want to access data from a content provider you have to specify a URI. 
  • Structure of a Content URI: content://authority/optionalPath/optionalID 
METHODS :  
query() : A method that accepts arguments and fetches the data from the desired table. Data is retired as a cursor object.

insert() To insert a new row in the database of the content provider. It returns the content URI of the inserted row. 

update() This method is used to update the fields of an existing row. It returns the number of rows updated. 

delete() This method is used to delete the existing rows.\ It returns the number of rows deleted. 

getType() This method returns the Multipurpose Internet Mail Extension(MIME) type of data to the given Content URI. 

onCreate() As the content provider is created, the android system calls this method immediately to initialise the provider. 

Fragments:

• Android Fragment is the part of activity, it is also known as sub-activity.

• There can be more than one fragment in an activity.

• Fragments represent multiple screen inside one activity.

• A fragment has its own layout and its own behavior with its own
lifecycle callbacks.

• You can add or remove fragments in an activity while the activity is running. 

LIFE CYCLE : 

1)onAttach(Activity) it is called only once when it is atta-ched with activity. 

2) onCreate(Bundle) It is used to initialize the fragment. 

3) onCreateView(LayoutInflater, ViewGroup,Bundle) creates and returns view hierarchy. 

4) onActivityCreated(Bundle) It is invoked after the completion of onCreate() method.

 *REMAINIBNG SAME AS ACTIVITY*

 ---------------------------------------------------------------------------- 

INTENT : 

• An Android Intent is an object carrying a message from one component to another component within the application or outside the application. 

• The intents can communicate messages among any of the three core components of an application - activities, services, and broadcast receivers. 

Android intents are mainly used to:
 
1. Start the service 
2. Launch an activity 
3. Display a web page 
4. Display a list of contacts 
5. Broadcast a message 
6. Dial a phone call etc.

INTENT OBJECT : 

1. Action: This is mandatory part of the Intent object and is a string naming the action to be performed. 

2. Data : The URI of the data to be acted on and the MIME type of that data.  

INTENT FILTERS 

• Intent Filters are used with implicit intents. 

• Activities which want to handle implicit intents will associate themselves with Intent Filters.

• As the name itself suggests, an Intent Filter essentially signifies: what types of intents an activity would like to receive and which ones it would like to filter. Creating Intent Filters 

• Intent Filters are defined in the manifest file using the tag. 

ANDROID LAYOUT : 
  • Layout basically refers to the arrangement of elements on a page. 
  • All elements in the layout are built with the help of Views and ViewGroups. 

ANDROID LAYOUT TYPES 
1. Linear Layout: LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally.
 
2. Relative Layout: RelativeLayout is a view group that displays child views in relative positions. 

3. Table Layout : TableLayout is a view that groups views into rows and columns. 

4. Absolute Layout : AbsoluteLayout enables you to specify the exact location of its children. 

5. Frame Layout : The FrameLayout is a placeholder on screen that you can use to display a single view. 

6. List View: ListView is a view group that displays a list of scrollable items. 

7. Grid View: GridView is a ViewGroup that displays items in a twodimensional,scrollable 

LAYOUT ATTRIBUTE 

• 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.  

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.