Posts

Context in Android

What is Context?              A Context provides access to information about the application state. It provides Activities, Fragments, and Services access to resource files, images, theme/styles, and external directory locations. It also enables access to Android's built-in services, such as those used for layout inflation, keyboard, and finding content providers. What is a Context used for? Explicitly starting a component (activity and services)  Creating a View Sending a broadcast Retrieving a System Service Access to information about the application state Application Context             It is an instance which is the singleton and can be accessed in an activity via getApplicationContext(). This context is tied to the lifecycle of an application. The application context can be used where you need a context whose lifecycle is separate from the current context or when you a...

Architecture Patterns for Android

Image
            Every operating system and platform has some guidelines for software architecture. These guidelines are general reusable solution that can be used for recurring problems in software development. The architecture patterns separate and define a clear single role for each component in app. A class is not going to be a multi-tasking component. Nowadays, it's very important to define what is the architecture for the application that   we're going to  develop.  We need to design for maintainability, scalability, and how testable this application is going  to be. Based on maintainability, scalability and testability, we can follow MVC or MVP patterns. Model-View-Controller (MVC) Pattern              MVC is most well known in the work development world right now, where basically it's a separation of parts, in other words, the model contains the entities of representation of...

Activity Lifecycle

Image
Activity Stack              For each running application, the android runtime system maintains an activity stack. When an application is launched, the first of the application’s activities to be started is placed onto the stack. When a second activity is started, it is placed on the top of the stack and the previous activity is pushed down. The activity at the top of the stack is referred to as the active (or running) activity. When the active activity exits, it is popped off the stack by the runtime and the activity located immediately beneath it in the stack becomes the current active activity. Activity Lifecycle              As a user interact with app, the android system will call various lifecycle callback methods on activity. As a user navigates through, out of, and back to your app, the activity instances in your app transition through different states in their lifecycle. T...

Android Process States

Image
            Processes host applications and applications are made up of components. Within an Android system, the current state of a process is defined by the highest-ranking active component within the application that it hosts.     Foreground processes have highest priority & empty process have lowest priority. So android will kill empty processes first in order to free up resources.  Foreground Process :              At any one time, there are unlikely to be more than one or two foreground processes active and these are usually the last to be terminated by the system. A foreground process must meet one or more of the following criteria : Hosts an activity with which the user is currently interacting. Hosts a service connected to the activity with which the user is interacting. Hosts a service that has indicated, via a call to startForeground(), that termination wou...

Android App Overview

Image
What is an app?              App is an abbreviation of application. Apps are software programs that are executed in a computer, smartphone or other device. The most common use for the term app is to denominate software programs that run on smartphones or mobile devices.  In Android, apps contain compiled Java code, data files and resources files used by each app. All of this comes packed up in a file  denominated Android Application Package (APK), with extension .apk. APKs are a variant of Java's JAR format.  Apps are packaged by using the tool AAPT (Android Asset Packaging Tool) which is included in Android SDK. To package an application, Java code is compiled, then, compiled libraries are also included and all the code is optimized so it can be executed in android runtime.  Types of Android Applications Foreground Apps -  These apps have a graphical interface that is executed while the user is using i...

Android Overview

Image
What is Android? "The first truly open and comprehensive platform for mobile devices. It includes  an operating system, user-interface and applications — all of the software to run  a mobile phone but without the proprietary obstacles that have hindered mobile  innovation." - Andy Rubin  ( Ex-Senior Vice President of Android at Google)         Android is an ecosystem made up of a combination of three components: An open-source development platform for creating and deploy applications A free, open-source operating system for mobile devices as smartphones, tablets, smartwatches etc. Devices, particularly mobile phones and watches, that run the Android operating system and the applications created for it Android SDK              The Android software development kit (SDK) includes a comprehensive set of development tools including a debugger, software libraries of prewritten...