• Call us: +91 9501707741
  • tutorialzdiary@gmail.com

ANDROID

ANDROID Tutorials

Chapter 1: Introduction
Chapter 2: What is Android?
Chapter 3: MVP Design Pattern
Chapter 4: Basic Java Programming
Chapter 5 : Android Programming
Chapter 6 : Web Services
Chapter 7 : App Store Process
Chapter 8 : Git Hub & other Resources
Chapter 9: Conclusion

ANDROID Interview Questions and Answers

Part 1: Java
Part 2: Android
Part 3: Android Core
Part 4:Database

ANDROID Installation

Part 1: Android Studio Setup

Chapter 5 : Android Programming

Android is an open source and Linux-based Operating System for mobile devices such as smartphones and tablet computers.

Speciality of android

  • open source
  • Larger developer and community research
  • Increased marketing
  • Inter app integration
  • Reduced cost of development
  • Higher Success Ratio
  • Rich development environment

 

Android IDEs

There are so many Technologies are available to develop android applications, the familiar technologies, but tools we are using now is

  • Android Studio
  • Eclips IDE

 

Android SDK

The Android SDK (software development kit) is a set of development tools used to develop applications for Android platform.

For Example Syntax :

<uses-sdk android:minSdkVersion=”integer”

android:targetSdkVersion=”integer”

android:maxSdkVersion=”integer” />

What is API Level?

API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.

The Android platform provides a framework API that applications can use to interact with the underlying Android system. The framework API consists of:

  • A core set of packages and classes
  • A set of XML elements and attributes for declaring a manifest file
  • A set of XML elements and attributes for declaring and accessing resources
  • A set of Intents
  • A set of permissions that applications can request, as well as permission enforcements included in the system

 

Platform Version API Level VERSION_CODE Notes
Android 6.0 23 M API Changes
Android 5.1 22 LOLLIPOP_MR1 Platform Highlights
Android 5.0 21 LOLLIPOP
Android 4.4W 20 KITKAT_WATCH KitKat for Wearables Only
Android 4.4 19 KITKAT Platform Highlights
Android 4.3 18 JELLY_BEAN_MR2 Platform Highlights
Android 4.2, 4.2.2 17 JELLY_BEAN_MR1 Platform Highlights
Android 4.1, 4.1.1 16 JELLY_BEAN Platform Highlights
Android 4.0.3, 4.0.4 15 ICE_CREAM_SANDWICH_MR1 Platform Highlights
Android 4.0, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH
Android 3.2 13 HONEYCOMB_MR2
Android 3.1.x 12 HONEYCOMB_MR1 Platform Highlights
Android 3.0.x 11 HONEYCOMB Platform Highlights
Android 2.3.4
Android 2.3.3
10 GINGERBREAD_MR1 Platform Highlights
Android 2.3.2
Android 2.3.1
Android 2.3
9 GINGERBREAD
Android 2.2.x 8 FROYO Platform Highlights
Android 2.1.x 7 ECLAIR_MR1 Platform Highlights
Android 2.0.1 6 ECLAIR_0_1
Android 2.0 5 ECLAIR
Android 1.6 4 DONUT Platform Highlights
Android 1.5 3 CUPCAKE Platform Highlights
Android 1.1 2 BASE_1_1
Android 1.0 1 BASE

 

Android Libraries

This category encompasses those Java-based libraries that are specific to Android development. Examples of libraries in this category include the application framework libraries in addition to those that facilitate user interface building, graphics drawing and database access. A summary of some key core Android libraries available to the Android developer is as follows −

android.app − Provides access to the application model and is the cornerstone of all Android applications.

android.content − Facilitates content access, publishing and messaging between applications and application components.

android.database − Used to access data published by content providers and includes SQLite database management classes.

android.opengl − A Java interface to the OpenGL ES 3D graphics rendering API.

android.os − Provides applications with access to standard operating system services including messages, system services and inter-process communication.

android.text − Used to render and manipulate text on a device display.

android.view − The fundamental building blocks of application user interfaces.

android.widget − A rich collection of pre-built user interface components such as buttons, labels, list views, layout managers, radio buttons etc.

android.webkit − A set of classes intended to allow web-browsing capabilities to be built into applications.

Having covered the Java-based core libraries in the Android runtime, it is now time to turn our attention to the C/C++ based libraries contained in this layer of the Android software stack.

Activities

An activity represents a single screen with a user interface,in-short Activity performs actions on the screen. 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.

For Example :

public class MainActivity extends Activity {

}

Create Android Application

The first step is to create a simple Android Application using Android studio. Follow the option File -> New -> New Project . Now name your application as HelloWorld , select Company domain , package name and click next.

In next page select select SDKs level , most commonly used SDKs level is API 15 by default because it will support upto 94% of mobile devices. click next and select the Activity you want , here select activity_name , layout_name that you are going to use and click finish.

Anatomy of Android Application

Before you run your app, you should be aware of a few directories and files in the Android project −

1. src

This contains the .java source files for your project. By default, it includes an MainActivity.java source file having an activity class that runs when your app is launched using the app icon.

2. gen

This contains the .R file, a compiler-generated file that references all the resources found in your project. You should not modify this file.

3. bin

This folder contains the Android package files .apk built by the ADT during the build process and everything else needed to run an Android application.

4. res/drawable-hdpi

This is a directory for drawable objects that are designed for high-density screens.

5. res/layout

This is a directory for files that define your app’s user interface.

6. res/values

This is a directory for other various XML files that contain a collection of resources, such as strings and colours definitions.

7. AndroidManifest.xml

This is the manifest file which describes the fundamental characteristics of the app and defines each of its components.

Main Activity .java

package com.example.helloworld;

import android.os.Bundle;

import android.app.Activity;

import android.view.Menu;

import android.view.MenuItem;

import android.support.v4.app.NavUtils;

public class MainActivity extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

getMenuInflater().inflate(R.menu.activity_main, menu);

return true;

}

}

The Manifest File

Whatever component you develop as a part of your application, you must declare all its components in a manifest.xml which resides at the root of the application project directory. This file works as an interface between Android OS and your application, so if you do not declare your component in this file, then it will not be considered by the OS.

For Example :

<manifest xmlns:android=”http://schemas.android.com/apk/res/android”

package=”com.example.helloworld”

android:versionCode=”1″

android:versionName=”1.0″ >

<uses-sdk

android:minSdkVersion=”8″

android:targetSdkVersion=”22″ />

<application

android:icon=”@drawable/ic_launcher”

android:label=”@string/app_name”

android:theme=”@style/AppTheme” >

<activity

android:name=”.MainActivity”

android:label=”@string/title_activity_main” >

<intent-filter>

<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER”/>

</intent-filter>

</activity>

</application>

</manifest>

The String File

The strings.xml file is located in the res/values folder and it contains all the text that your application uses. For example, the names of buttons, labels, default text, and similar types of strings go into this file. This file is responsible for their textual content.

For Example :

<resources>

<string name=”app_name”>HelloWorld</string>

<string name=”hello_world”>Hello world!</string>

<string name=”menu_settings”>Settings</string>

<string name=”title_activity_main”>MainActivity</string>

</resources>

The Layout File

The activity_main.xml is a layout file available in res/layout directory, that is referenced by your application when building its interface. You will modify this file very frequently to change the layout of your application.

For Example :

<RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android”

xmlns:tools=”http://schemas.android.com/tools”

android:layout_width=”match_parent”

android:layout_height=”match_parent” >

<TextView

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”

android:layout_centerHorizontal=”true”

android:layout_centerVertical=”true”

android:padding=”@dimen/padding_medium”

android:text=”@string/hello_world”

tools:context=”.MainActivity” />

</RelativeLayout>

image_pdfimage_print

Newsletter
Training Enquiry