Core Building Blocks of Android

Android Application Components
The basic components of any android application are as follows:
  • Activities
  • Services
  • Broadcast Receivers
  • Content Providers
Android Application components

Activities
An activity is a class that represents a single screen. It is like a Frame in AWT.Activity is a Java code that supports a screen or UI.Since mobile phone screens are small, an activity typically takes up the whole screen. If you open multiple activities they are stacked at top of each other . You can’t arrange activities side by side, like you can do with desktop windows.
Syntax
public class MainActivity extends Activity {
}
Services
A service is a component which runs in the background without direct interaction with the user. As the service has no user interface, it is not bound to the lifecycle of an activity. They handle background processing associated with an application. There are two types of services local and remote. Local service is accessed from within the application whereas remote service,accessed remotely from other applications running on the same device.
Syntax
public class MyService extends Service {
}
Broadcast Receivers
They handle communication between Android OS and applications.
Now create the service implementation class by inheriting the Service class and overridding its callback methods.
Syntax
public class MyReceiver  extends  BroadcastReceiver {
  public void onReceive(context,intent){}
}
Content Providers
Content Providers are used to share data between the applications. Such requests, handled by the methods of the ContentResolver class. The data may be stored in the file system, the database or somewhere else entirely.
Syntax
public class MyContentProvider extends  ContentProvider {
  public void onCreate(){}
}
Learn more :  Architecture of android
Advantages of Android App Development
  • Low Investment & High ROI
  • Open Source
  • Easy to Integrate
  • Multiple Sales Channels
  • Easy Adoption
Additional Components
Fragments - Fragments are like parts of activity. An activity can display one or more fragments on the screen at the same time. A fragment can implement a behaviour that has no user interface component, Passing information between app screens
Intent
Android Intent is the message that is passed between components such as activities, content providers, broadcast receivers, services etc.
Types of Android Intents
  1. Implicit Intent - Implicit Intent doesn't specifiy the component.
               Intent i=new Intent(Intent.ACTION_VIEW);  
               intent.setData(Uri.parse("http://www.Google.com"));  
               startActivity(i);  
2. Explicit Intent - Explicit Intent specifies the component. In such case, intent provides the external class to be invoked.
    Intent i = new Intent(getApplicationContext(), ActivityTwo.class);  
     startActivity(i);  
Layouts
View hierarchies that control screen format and appearance of the views.
Types of Layouts
  • Linera Layout
  • RelativeLayout 
  • TableLayout
  • AbsoluteLayout
  • FrameLayout 
  • ListView
  • GridView
Manifest
Configuration file for the application.
Resources
External elements, such as strings, constants and drawable pictures.
Create your own Android App - Android Training  

Comments

Post a Comment

Popular posts from this blog

Google Declared Best Android Apps Of 2017: No Place For Facebook Or Whatsapp That Make Everyone Love It

Steps for Android Studio - Environment Setup