Prof. Shardul Agravat: Unit - 1 Android OS
Prof. Shardul Agravat: Unit - 1 Android OS
Android OS
• How to obtain the tools and SDK for developing Android applications
• Android APIs
What is Android?
• Android is a mobile operating system that is based on a modified version of
Linux.
• In 2005, as part of its strategy to enter the mobile space, Google purchased
Android and took over its development work (as well as its development team).
• Google wanted Android to be open and free; hence, most of the Android code
was released under the open source Apache License, which means that anyone
who wants to use Android can do so by downloading the full Android source
code.
Android Versions
Features of Android
• Connectivity • Multi-touch
• Messaging • Multi-tasking
• Slow response
• Libraries
• Android runtime
• Application framework
• Applications
Installing Android
forms etc.
the views.
pictures.
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The Strings File strings.xml
<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 activity_main.xml
<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>
Running the Application
Application Components
• Activities: They dictate the UI and handle the user interaction to the smart
phone screen.
– An activity is implemented as a subclass of Activity class as follows −
public class MainActivity extends Activity
{
}
• Broadcast Receivers: They handle communication between Android OS
and applications.
public class MyReceiver extends BroadcastReceiver
{
public void onReceive(context,intent)
{
}
}
• Content Providers: They handle data and database management issues.
public class MyContentProvider extends ContentProvider
{
public void onCreate()
{
}
}
Android APIs