Android: Android is a stack of software for mobile devices which has Operating System, middleware and some key applications.
Android Architecture: Consists of four layers
- Linux Kernel
- Libraries + (Android Runtime:[Core Libraries and DVM])
- Application Framework (Activity Manager, Window Manager, Content Providers, View System, Package manager, Telephony manager, Resource, Notification, Location managers)
- Application (Contacts, Browser, Phone, etc)
Android Application Architecture: Android Application Architecture has the following components:
- Services – A
Serviceis an application component that can perform long-running operations in the background and does not provide a user interface.
Activityis an application component that provides a screen with which users can interact in order to do something. Each activity is given a window in which to draw its user interface.
- Intent – To perform inter-communication between activities or services
- Resource Externalization – such as strings and graphics
- Notification signaling users – light, sound, icon, notification, dialog etc.
- Content Providers – They share data between applications
Exceptions in Android: The following are the exceptions that are supported by Android:
- InflateException : When an error conditions are occurred, this exception is thrown
- Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown
- SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS
- WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParams token.
APK Format: Application Package. The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file.
Action: A description of something that an Intent sender desires.
Intents: To perform inter-communication between activities or services. Three of the core components of an application — activities, services, and broadcast receivers — are activated through messages, called intents.
Intent-filter: Activities and intent receivers include one or more filters in their manifest to describe what kinds of intents or messages they can handle or want to receive.
Intent Receivers: An application class that listens for messages broadcast by calling Context.broadcastIntent().
Activity: A single screen in an application, with supporting Java code.
Nine Patch Bitmap: It is a resizable bitmap resource that can be used for backgrounds or other images on the device. The Nine Patch class permits drawing a bitmap in nine sections. The four corners are unscaled; the four edges are scaled in one axis, and the middle is scaled in both axes.
Resources: A user-supplied XML, bitmap, or other files, injected into the application build process, which can later be loaded from code.
Difference between File, Class and Activity in Android:
File – It is a block of arbitrary information, or resource for storing information. It can be of any type.
Class – It’s a compiled form of .Java file. Android finally used this .class files to produce an executable apk.
Activity – An activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view.
Sticky Intent: These are broadcasts whose data is held by the system after being finished, so that clients can quickly retrieve that data without having to wait for the next broadcast.
Context: As the name suggests, it’s the context of current state of the application/object. It lets newly created objects understand what has been going on. Typically you call it to get information regarding another part of your program (activity, package/application).
ANR: Android allows the system to protect the applications that are not responsive for a period of time by displaying a status called as ANR (Application not responding). Methods should use the main thread for work, as it takes long time for the main thread to complete the task. The work should be divided and another thread named as child thread be used for executing more tasks, as it takes less time. Main thread should provide a handler for child threads to post back upon completion.
Different Storage Methods in Android:
Shared Preferences: Store private primitive data in key-value pairs
Internal Storage: Store private data on the device memory.
External Storage: Store public data on the shared external storage.
SQLite Databases: Store structured data in a private database.
Network Connection: Store data on the web with your own network server.
Dialogbox in Android:
–Alert Dialog: it supports 0 to 3 buttons with a list of selectable elements that includes check boxes and radio buttons.
–Progress Dialog: it displays the progress of any dialog or application. It is an extension of Alert Dialog and supports adding buttons.
–DatePickerDialog: it is used to give provision to the user to select the date.
–TimePickerDialog: it is used to give provision to the user to select the time.
Broadcast Receivers: A broadcast receiver is a component that does nothing but receives and reacts to broadcast announcements. All receivers extend the BroadcastReceiver base class.
Content providers: A content provider makes a specific set of the application’s data available to other applications.
Adb: Android Debug Bridge, a command-line debugging application shipped with the SDK. It provides tools to browse the device, copy tools on the device, and forward ports for debugging.
Application: A collection of one or more activities, services, listeners, and intent receivers. An application has a single manifest, and is compiled into a single .apk file on the device.
DDMS: Dalvik Debug Monitor Service, a GUI debugging application shipped with the SDK. It provides screen capture, log dump, and process examination capabilities.
Service: A class that runs in the background to perform various persistent actions, such as playing music or monitoring network activity.
TTL: Time-to-live (TTL) is a value in an Internet Protocol (IP) packet that tells a network router whether or not the packet has been in the network too long and should be discarded.
URI: Android uses URI strings both for requesting data (e.g., a list of contacts) and for requesting actions (e.g., opening a Web page in a browser). Both are valid URI strings, but have different values.