Android session 1
Upcoming SlideShare
Loading in...5
×
 

Android session 1

on

  • 530 views

Android application development presentation-1

Android application development presentation-1

Statistics

Views

Total Views
530
Views on SlideShare
421
Embed Views
109

Actions

Likes
0
Downloads
2
Comments
0

3 Embeds 109

http://webapp-guideline.blogspot.in 75
http://www.webapp-guideline.blogspot.in 27
http://webapp-guideline.blogspot.com 7

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Android session 1 Android session 1 Presentation Transcript

  • Android Application Development Session-1 From Beginner to Advanced By : Ahesanali Suthar email: ahesanali.suthar@gmail.com
  • Topics to be Covered 1. Introduction of Android. 2. Android SDK. 3. Setting Up Development Environment (Windows,Linux). 4. Creating Project in Eclipse. 5. Tutorial-1: Hello World 6. Android Project Directory Structure.
  • 1. Introduction of Android ● Android is a Linux-based operating system designed primarily for touchscreen mobile devices such as smartphones and tablet computers, developed by Google in conjunction with the Open Handset Alliance. ● Initially developed by Android Inc, whom Google financially backed and later purchased in 2005. ● Android has a large community of developers writing applications ("apps") that extend the functionality of devices, written primarily in a customized version of Java.They are available for download through Google Play or third-party sites. ● The first Android-powered phone was sold in October 2008, and by the end of 2010 Android had become the world's leading smartphone platform, overtaking Symbian which held its record for years
  • 2. Android SDK ● The Android SDK (SDK refers to Software Development KIT)provides you the API libraries and developer tools necessary to build, test, and debug apps for Android. ● Like in windows we have .NET Framework as a SDK for developing the Softwares for windows platform.Similarly java provide JDK(Java Dev. Kit). But java provide kit for Linux as well as for windows. ● To Download SDK: http://developer.android.com/sdk/index.html ● To know more about Android SDK: http://developer.android. com/sdk/exploring.html
  • 3. Dev Environment System Requirements.(OS) (http://developer.android.com/sdk/index.html) ● ● ● Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit) Mac OS X 10.5.8 or later (x86 only) Linux (tested on Ubuntu Linux, Lucid Lynx) GNU C Library (glibc) 2.7 or later is required. On Ubuntu Linux, version 8.04 or later is required. 64-bit distributions must be capable of running 32-bit applications. Eclipse IDE ● ● ● ● Eclipse 3.6.2 (Helios) or greate () Android SDK JDK 6 (JRE alone is not sufficient) Android Development Tools plugin (ADT)
  • 3. Dev Environment (Cont.) ● After Downloading Android SDK,We have to download platform packages.
  • 3. Dev Environment (Cont.) ● Once we are done with downloading platform packages either we are developing on Windows or Linux or Mac we need to install ADT (Android Development Toolkit) in Eclipse IDE. To Install ADT into the Eclipse IDE follow below steps. 1. Open Eclipse IDE. 2. Click on Help->Install New Software from the menu bar. 3. Then install window is open then Click on Add Button
  • 3. Dev Environment (Cont.) ● Now when you click on Add button,you will found below window. Insert the Name as ADT(any name can be given) and Location of ADT zip file. Location can be given by clicking on Archive button and then press Ok.
  • 3. Dev Environment (Cont.) Setting up SDK path into Eclipse IDE ● Open Preferences window by clicking Window -> Preferences. ● If we have properly installed ADT in Eclipse we have Android option in Preferences window. ● As you can see on above image by Clicking on Android in preferences window we have option available for SDK path. ● So by clicking Browse button please select android-sdk-window folder from your computer.so SDK location field have complete path of Android SDK.So finally you have a setup ready for Android Development.
  • 4.Creating Project in Eclipse ● ● Open Eclipse IDE. Click on File->New->Android Project from file menu. ● Application Name is the app name that appears to users. For this project, use "My First App." Project Name is the name of your project directory and the name visible in Eclipse. Package Name is the package namespace for your app. Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application. Compile With is the platform version against which you will compile your app. Click on Next button. ● ● ● ● ● ●
  • 4.Creating Project in Eclipse ● ● ● The next screen can help you create a launcher icon for your app.Click Next. Now you can select an activity template from which to begin building your app. For this project, select BlankActivity and click Next Finally click on the Finish.
  • 5.Tutorial-1: Hello World ● After creating project in eclipse ,run the project by right click on the project name and Runs As -> Android Application. ● If simulator is created previously project will run in that other wise it eclipse will ask for create new simulator.
  • 6.Android Project Directory Structure. ● Now we are learning how this hello world is printed on the screen. ● Following Image shows android project directory structure. ● src: This is the directory where all java files for the project will reside. In java there is a concept of package so here files are maintained in packages. Like in our case there is one package called com. maktabah which we have entered at the time of project creation. ● gen: In this folder the files which are generated by android-sdk.We are not changing any of the files here,Because this is the internal reference to sdk.
  • 6.Android Project Directory Structure. ● assets: Here resource type information will goes.Like fonts file,web-pages(when we are developing android app in HTML5) ● bin: When are compiling the project all class files are generated here by java compiler. ● res: This is important folder we are discussing each inner directory in detail. ● drawable-hdpi,drawable-ldpi,drawable-mdpi, drawable-xhdpi: These are the directories where we are putting images that are used in projects. ○ But we have question like why these many directories(4 directories).So the answer is these are the directory dedicated for different screen density(in Desktop computer terminology we call it resolution of the Monitor).
  • 6.Android Project Directory Structure. ○ ● How android app decide which image to talk when it is referenced from code we will see it when we see implementation of the sample tutorial. To read more about for these directories please follow the link: http://developer.android. com/guide/practices/screens_support.html ● Consider following image for example.
  • 6.Android Project Directory Structure. i. ii. iii. iv. xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp ● layout: This is the directory where we are putting all design files in xml format.As we can see from right side image when we create new project default main.xml file is there. ● These layout xmls files are responsible for the userinterface and look and feel of the app. ● Like in windows application when we are working in visual studio IDE we have two files one for design and one for code.Whenever we place button in design and double click on it and button_click function in different file and button User interface is in design file
  • 6.Android Project Directory Structure. ● Sample Layout code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>
  • 6.Android Project Directory Structure. ● values: It contains all xml file for values like styles xml, string constants and other. ● As we can see im right side image the when we create a new android project it only contains string.xml which contains strings values in xml format for whole project. ● Strings for lable,error message and titles etc are stored in string.xml files.We can also write strings at lable in layout.xml, but it is good practice to declare strings in string.xml for managing resource in project and reusability
  • 6.Android Project Directory Structure. ● Example of basic string.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hello World, HelloWorldActivity!</string> <string name="app_name">HelloWorld</string> </resources>
  • 6.Android Project Directory Structure. AndroidManifest.xml: ● This is the file where we declaring application components like Activities, Services,Broadcast-Receivers. ● Allowing permissions to application ● We can also call it is a configuration file for the app.
  • 6.Android Project Directory Structure. Sample of Manifest for HelloWord App: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.maktabah" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".HelloWorldActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
  • Questions ?