際際滷

際際滷Share a Scribd company logo
Android Development Tutorial


           Nikhil Yadav
 CSE40816/60816 - Pervasive Health
            Fall 2011
Outline

 Setting up the Android Development
Environment (Windows)

    Starters Android Hello World empty project

    Android project components

    Example: Tabbed application project

 Accessing Sensors on an Android Device:
GPS, accelerometers and the Google API

  Database connections  Local SQLite and
remote access
Android Development Environment

    Download the latest JDK (Java distribution)

Download the Eclipse IDE (e.g. Galileo) from:



www.eclipse.org/downloads/

 Install the Android SDK starter package from:
http://developer.android.com/sdk/index.html

 In Eclipse, install the ADT (Android Developer
Tools) plugin:
http://developer.android.com/sdk/eclipse-adt.html

 Instructions on setting up the SDK and
development Environment can be found on:
http://developer.android.com/sdk/installing.html
The Android SDK starter package

  Not the full development environment, includes
the core SDK tools

   Keep track of where you have downloaded this
 it is required for the ADT plugin setup, e.g.
C:Program Filesandroid-sdk-windowsplatform-
tools>

    Useful for adb commands
The ADT plugin


  Gives access to Android development tools
from within the Eclipse IDE

 Automates the process of building a new
Android project by setting up all the basic files
needed for development

 Allows code signing of your app so it can be
distributed
Installing the ADT plugin
(Link: http://developer.android.com/sdk/eclipse-adt.html#installing)

To simplify ADT setup, it is recommend installing the Android SDK prior to installing ADT

.Eclipse 3.5 (Galileo) and 3.6 (Helios)

1.Start Eclipse, then select Help>Install New Software....
2.Click Add, in the top-right corner.
3.In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and
    the following URL for the Location:
https://dl-ssl.google.com/android/eclipse/
Note: If you have troubles try using "http" instead of "httpsClick OK.
4.In the Available Software dialog, select the checkbox next to Developer Tools
    and click Next.
5.In the next window, you'll see a list of the tools to be downloaded. Click Next.
6.Read and accept the license agreements, then click Finish.
7.When the installation completes, restart Eclipse.
Configuring the ADT plugin


1.Select Window>Preferences...to open the Preferences panel (Mac OS
   X:Eclipse>Preferences).

2.Select Android from the left panel.

3.For the SDK Location in the main panel, click Browse...and locate your
   downloaded SDK directory (e.g. C:Program Filesandroid-sdk-windows)

4.Click Apply, then OK
Android SDK and AVD manager

  Add your virtual development devices using this

  AVD is a target device simulator: no sensors
Android tutorial
Android SDK and AVD Manager

    Used for updating Android SDK tools etc.
Pointers

Update the systems PATH variable to recognize two folders inside your
  android-sdk-winwows. The first is: tools and the second is platform-
  tools.

1.Windows > Start > Control Panel > System > Advanced > Environment
   Variables > System Variables > PATH > Edit
2.Add references to the sub-folders mentioned above. In this example:
   c:android-sdk-windowstools;C:android-sdk-windowsplatform-tools;
3.OK

Make sure Java and Eclipse Environments and path variables are setup
  correctly:

Some interesting tutorials on Android projects can be found on:

http://www.hometutorials.com/google-android.html
Starters: Hello World
Android tutorial
Android tutorial
Android Project Components
Once you complete the New Project Wizard, ADT creates the following
  folders and files in your new project:

src/ Includes your stub Activity Java file. All other Java files for your
   application go here.

<Android Version>/ (e.g., Android 1.5/) Includes the android.jar file
  that your application will build against.

gen/ This contains the Java files generated by ADT, such as your
  R.java file and interfaces created from AIDL files.

assets/This is empty. You can use it to store raw asset files.

res/A folder for your application resources, such as drawable files,
   layout files, string values, etc.

AndroidManifest.xml The Android Manifest for your project.

default.propertiesThis file contains project settings, such as the build
  target.
Android tutorial
Android tutorial
Android tutorial
Android tutorial
Android tutorial
Android tutorial
Android tutorial
A Tabbed application
Android tutorial
mainmenu.java
main.xml
Android Manifest.xml
tabs.java
Accessing Sensors
 There are various sensors on the Android
phones, e.g. GPS, camera, accelerometer

   Cannot be tested on Simulator

Tutorial and sample source code to use GPS
and accelerometer sensors available soon

 Using the Wi-Fi and Bluetooth Interfaces
instructions on:
http://www.tutorialforandroid.com/2009/10/turn-off-turn-on-wifi-in-android-using.html
http://developer.android.com/guide/topics/wireless/bluetooth.html
GPS Sensor Access
 To use GPS functionality in your Android application, you'll
need to add the ACCESS_FINE_LOCATION permission to
the AndroidManifest.xml file.
 <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />

In Android, location-based services are provided by the
LocationManager class located in the android.location
package.

Using the LocationManager class, your application can
obtain periodic updates of the device's geographical locations
as well as fire an intent when it enters the proximity of a
certain location.
Accelerometer and Access to other
                Sensors
 An instance of the SensorManager is required in order to
retrieve informations about the supported sensors.

 No permission is required to access the sensor service. It is
then possible to retrieve the list of available sensors of a
certain type.

For an accelerometer sensor, the type to use is given by the
Sensor.TYPE_ACCELEROMETER constant.

If at least one Sensor exists, it is possible to register a
SensorEventListener for a Sensor of the list.

It is possible to specify the delivering rate for sensor
events. Specified rate must be one of :
SensorManager.SENSOR_DELAY_FASTEST : as fast as
possible

SensorManager.SENSOR_DELAY_GAME : rate suitable for
game

SensorManager.SENSOR_DELAY_NORMAL : normal rate

SensorManager.SENSOR_DELAY_UI : rate suitable for UI
Thread
Android and Databases
Access to remote database e.g. MySQL can
occur using a PHP script hosted on the server
performing the query and JSON formatting for
data exchange for reference check out the
example at:

http://www.helloandroid.com/tutorials/connecting-
mysql-database

   Local light weight database system.

 http://developer.android.com/reference/android/d
atabase/sqlite/SQLiteDatabase.html
Questions?




http://developer.android.com/index.html

More Related Content

What's hot (20)

Android study jams 1
Android study jams 1Android study jams 1
Android study jams 1
DSCBVRITH
Android Study Jam - Info Session
Android Study Jam - Info SessionAndroid Study Jam - Info Session
Android Study Jam - Info Session
AITIKDANDAPAT
Intro session kotlin
Intro session kotlinIntro session kotlin
Intro session kotlin
MohammedMehdiPatel
Android study jams 2021 [collab] [master]
Android study jams 2021 [collab] [master]Android study jams 2021 [collab] [master]
Android study jams 2021 [collab] [master]
GDSCIIITBbsr
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENMAndroid Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
GDSCBVCOENM
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and Jetpack
Sunita Singh
Android Workshop Part 1
Android Workshop Part 1Android Workshop Part 1
Android Workshop Part 1
NAILBITER
Info session on android study jams
Info session on android study jamsInfo session on android study jams
Info session on android study jams
ArjavDesai3
ASJ Workshop - Introduction
ASJ Workshop - IntroductionASJ Workshop - Introduction
ASJ Workshop - Introduction
Amsavarthan Lv
Android Studio vs. ADT
Android Studio vs. ADTAndroid Studio vs. ADT
Android Studio vs. ADT
Dominik Helleberg
The First Ever Android Meet-up
The First Ever Android Meet-upThe First Ever Android Meet-up
The First Ever Android Meet-up
vriddhigupta
Webinar on Google Android SDK
Webinar on Google Android SDKWebinar on Google Android SDK
Webinar on Google Android SDK
Schogini Systems Pvt Ltd
Monkey Talk
Monkey TalkMonkey Talk
Monkey Talk
Jignesh Bhadani
Android studio
Android studioAndroid studio
Android studio
貼eljko Plesac
Android As a tool of innovation
Android  As a tool of innovation Android  As a tool of innovation
Android As a tool of innovation
Pallab Sarkar
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android Studio
Michael Pan
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android Development
Willow Cheng
Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?
avocarrot
How to configure monkey talk android agent
How to configure monkey talk android agentHow to configure monkey talk android agent
How to configure monkey talk android agent
Dasun Eranthika
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
Arcadian Learning
Android study jams 1
Android study jams 1Android study jams 1
Android study jams 1
DSCBVRITH
Android Study Jam - Info Session
Android Study Jam - Info SessionAndroid Study Jam - Info Session
Android Study Jam - Info Session
AITIKDANDAPAT
Android study jams 2021 [collab] [master]
Android study jams 2021 [collab] [master]Android study jams 2021 [collab] [master]
Android study jams 2021 [collab] [master]
GDSCIIITBbsr
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENMAndroid Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
Android Study Jam 1 Day 1 | December 2021 | GDSC BVCOENM
GDSCBVCOENM
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and Jetpack
Sunita Singh
Android Workshop Part 1
Android Workshop Part 1Android Workshop Part 1
Android Workshop Part 1
NAILBITER
Info session on android study jams
Info session on android study jamsInfo session on android study jams
Info session on android study jams
ArjavDesai3
ASJ Workshop - Introduction
ASJ Workshop - IntroductionASJ Workshop - Introduction
ASJ Workshop - Introduction
Amsavarthan Lv
The First Ever Android Meet-up
The First Ever Android Meet-upThe First Ever Android Meet-up
The First Ever Android Meet-up
vriddhigupta
Android As a tool of innovation
Android  As a tool of innovation Android  As a tool of innovation
Android As a tool of innovation
Pallab Sarkar
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android Studio
Michael Pan
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android Development
Willow Cheng
Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?
avocarrot
How to configure monkey talk android agent
How to configure monkey talk android agentHow to configure monkey talk android agent
How to configure monkey talk android agent
Dasun Eranthika
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
Arcadian Learning

Similar to Android tutorial (20)

Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Danish_k
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Jagannath Das
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Vaiga Nandhakumar
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
Rehna Renu
Android chapter02-setup1-sdk
Android chapter02-setup1-sdkAndroid chapter02-setup1-sdk
Android chapter02-setup1-sdk
Tran Le Hoan
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
TOPS Technologies
Android tutorial for beginners-traininginbangalore.com
Android tutorial for beginners-traininginbangalore.comAndroid tutorial for beginners-traininginbangalore.com
Android tutorial for beginners-traininginbangalore.com
TIB Academy
Methods to set up android app development environment
Methods to set up android app development environmentMethods to set up android app development environment
Methods to set up android app development environment
astoria0128
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Keshav Chauhan
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Ed Zel
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Techacademy Software
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
katayoon_bz
Android-Tutorial.ppt
Android-Tutorial.pptAndroid-Tutorial.ppt
Android-Tutorial.ppt
siddharthsingh496426
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Avinash Nandakumar
Android
AndroidAndroid
Android
Jesus_Aguirre
Android app developers in bangalore- thorsignia
Android app developers in bangalore- thorsigniaAndroid app developers in bangalore- thorsignia
Android app developers in bangalore- thorsignia
charan Teja
Android Training in Chandigarh | Industrial Training in Android Apps Development
Android Training in Chandigarh | Industrial Training in Android Apps DevelopmentAndroid Training in Chandigarh | Industrial Training in Android Apps Development
Android Training in Chandigarh | Industrial Training in Android Apps Development
Big Boxx Animation Academy
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
Gunjan Kumar
Mobile app development snovasys
Mobile app development   snovasysMobile app development   snovasys
Mobile app development snovasys
xamarindevelopment
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorial
Synapseindiappsdevelopment
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Danish_k
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
Rehna Renu
Android chapter02-setup1-sdk
Android chapter02-setup1-sdkAndroid chapter02-setup1-sdk
Android chapter02-setup1-sdk
Tran Le Hoan
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
TOPS Technologies
Android tutorial for beginners-traininginbangalore.com
Android tutorial for beginners-traininginbangalore.comAndroid tutorial for beginners-traininginbangalore.com
Android tutorial for beginners-traininginbangalore.com
TIB Academy
Methods to set up android app development environment
Methods to set up android app development environmentMethods to set up android app development environment
Methods to set up android app development environment
astoria0128
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Ed Zel
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
katayoon_bz
Android app developers in bangalore- thorsignia
Android app developers in bangalore- thorsigniaAndroid app developers in bangalore- thorsignia
Android app developers in bangalore- thorsignia
charan Teja
Android Training in Chandigarh | Industrial Training in Android Apps Development
Android Training in Chandigarh | Industrial Training in Android Apps DevelopmentAndroid Training in Chandigarh | Industrial Training in Android Apps Development
Android Training in Chandigarh | Industrial Training in Android Apps Development
Big Boxx Animation Academy
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
Gunjan Kumar
Mobile app development snovasys
Mobile app development   snovasysMobile app development   snovasys
Mobile app development snovasys
xamarindevelopment
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorial
Synapseindiappsdevelopment

Recently uploaded (20)

How to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in OdooHow to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in Odoo
Celine George
Digital Electronics - Boolean Algebra (Module 2) - Dr. G.S. Virdi
Digital Electronics - Boolean Algebra (Module 2) - Dr. G.S. VirdiDigital Electronics - Boolean Algebra (Module 2) - Dr. G.S. Virdi
Digital Electronics - Boolean Algebra (Module 2) - Dr. G.S. Virdi
GS Virdi
UNIT 1 Introduction to communication.pptx
UNIT 1 Introduction to communication.pptxUNIT 1 Introduction to communication.pptx
UNIT 1 Introduction to communication.pptx
HARIHARAN A
BUSINESS QUIZ | THE QUIZ CLUB OF PSGCAS | 17TH MARCH 2025 .pptx
BUSINESS QUIZ | THE QUIZ CLUB OF PSGCAS | 17TH MARCH 2025 .pptxBUSINESS QUIZ | THE QUIZ CLUB OF PSGCAS | 17TH MARCH 2025 .pptx
BUSINESS QUIZ | THE QUIZ CLUB OF PSGCAS | 17TH MARCH 2025 .pptx
Quiz Club of PSG College of Arts & Science
How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17
Celine George
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptxBIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
maniramkumar
MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025
MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025
MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025
Quiz Club of PSG College of Arts & Science
Introduction to Drug Design.pptx by Mrs. Manjushri P. Dabhade
Introduction to Drug Design.pptx by Mrs. Manjushri P. DabhadeIntroduction to Drug Design.pptx by Mrs. Manjushri P. Dabhade
Introduction to Drug Design.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
Anthelmintic Agent.pptx by Mrs. Manjushri P. Dabhade
Anthelmintic Agent.pptx by Mrs. Manjushri P. DabhadeAnthelmintic Agent.pptx by Mrs. Manjushri P. Dabhade
Anthelmintic Agent.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
Anti-Protozoal Agents.pptx by Mrs. Manjushri P. Dabhade
Anti-Protozoal Agents.pptx by Mrs. Manjushri P. DabhadeAnti-Protozoal Agents.pptx by Mrs. Manjushri P. Dabhade
Anti-Protozoal Agents.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
SUPPOSITORIES
SUPPOSITORIESSUPPOSITORIES
SUPPOSITORIES
Shantanu Ranjan
2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions
leigh441292
Using social media to learn from conferences
Using social media to learn from conferencesUsing social media to learn from conferences
Using social media to learn from conferences
Sue Beckingham
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
Prabhakar Singh Patel
Proteins, Bio similars & Antibodies.pptx
Proteins, Bio similars &  Antibodies.pptxProteins, Bio similars &  Antibodies.pptx
Proteins, Bio similars & Antibodies.pptx
Ashish Umale
Mixed_Sinhala_Dual_Male_Names (1).pdf...
Mixed_Sinhala_Dual_Male_Names (1).pdf...Mixed_Sinhala_Dual_Male_Names (1).pdf...
Mixed_Sinhala_Dual_Male_Names (1).pdf...
keshanf79
PUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological HealthPUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological Health
Jonathan Hallett
Pushyabhuti Dynesty Vardhan Vamsha Early Rulers.pptx
Pushyabhuti Dynesty Vardhan Vamsha Early Rulers.pptxPushyabhuti Dynesty Vardhan Vamsha Early Rulers.pptx
Pushyabhuti Dynesty Vardhan Vamsha Early Rulers.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
The Effectiveness of Manual Therapies on the Thoracic.pptx
The Effectiveness of Manual Therapies on the Thoracic.pptxThe Effectiveness of Manual Therapies on the Thoracic.pptx
The Effectiveness of Manual Therapies on the Thoracic.pptx
SamarHosni3
TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...
TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...
TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...
Nguyen Thanh Tu Collection
How to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in OdooHow to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in Odoo
Celine George
Digital Electronics - Boolean Algebra (Module 2) - Dr. G.S. Virdi
Digital Electronics - Boolean Algebra (Module 2) - Dr. G.S. VirdiDigital Electronics - Boolean Algebra (Module 2) - Dr. G.S. Virdi
Digital Electronics - Boolean Algebra (Module 2) - Dr. G.S. Virdi
GS Virdi
UNIT 1 Introduction to communication.pptx
UNIT 1 Introduction to communication.pptxUNIT 1 Introduction to communication.pptx
UNIT 1 Introduction to communication.pptx
HARIHARAN A
How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17
Celine George
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptxBIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
maniramkumar
Introduction to Drug Design.pptx by Mrs. Manjushri P. Dabhade
Introduction to Drug Design.pptx by Mrs. Manjushri P. DabhadeIntroduction to Drug Design.pptx by Mrs. Manjushri P. Dabhade
Introduction to Drug Design.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
Anthelmintic Agent.pptx by Mrs. Manjushri P. Dabhade
Anthelmintic Agent.pptx by Mrs. Manjushri P. DabhadeAnthelmintic Agent.pptx by Mrs. Manjushri P. Dabhade
Anthelmintic Agent.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
Anti-Protozoal Agents.pptx by Mrs. Manjushri P. Dabhade
Anti-Protozoal Agents.pptx by Mrs. Manjushri P. DabhadeAnti-Protozoal Agents.pptx by Mrs. Manjushri P. Dabhade
Anti-Protozoal Agents.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions
leigh441292
Using social media to learn from conferences
Using social media to learn from conferencesUsing social media to learn from conferences
Using social media to learn from conferences
Sue Beckingham
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
Prabhakar Singh Patel
Proteins, Bio similars & Antibodies.pptx
Proteins, Bio similars &  Antibodies.pptxProteins, Bio similars &  Antibodies.pptx
Proteins, Bio similars & Antibodies.pptx
Ashish Umale
Mixed_Sinhala_Dual_Male_Names (1).pdf...
Mixed_Sinhala_Dual_Male_Names (1).pdf...Mixed_Sinhala_Dual_Male_Names (1).pdf...
Mixed_Sinhala_Dual_Male_Names (1).pdf...
keshanf79
PUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological HealthPUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological Health
Jonathan Hallett
The Effectiveness of Manual Therapies on the Thoracic.pptx
The Effectiveness of Manual Therapies on the Thoracic.pptxThe Effectiveness of Manual Therapies on the Thoracic.pptx
The Effectiveness of Manual Therapies on the Thoracic.pptx
SamarHosni3
TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...
TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...
TI LI畛U CHUYN SU L畛P 12 THEO CH働NG TRNH M畛I DNG CHO C畉 3 B畛 SCH N THI...
Nguyen Thanh Tu Collection

Android tutorial

  • 1. Android Development Tutorial Nikhil Yadav CSE40816/60816 - Pervasive Health Fall 2011
  • 2. Outline Setting up the Android Development Environment (Windows) Starters Android Hello World empty project Android project components Example: Tabbed application project Accessing Sensors on an Android Device: GPS, accelerometers and the Google API Database connections Local SQLite and remote access
  • 3. Android Development Environment Download the latest JDK (Java distribution) Download the Eclipse IDE (e.g. Galileo) from: www.eclipse.org/downloads/ Install the Android SDK starter package from: http://developer.android.com/sdk/index.html In Eclipse, install the ADT (Android Developer Tools) plugin: http://developer.android.com/sdk/eclipse-adt.html Instructions on setting up the SDK and development Environment can be found on: http://developer.android.com/sdk/installing.html
  • 4. The Android SDK starter package Not the full development environment, includes the core SDK tools Keep track of where you have downloaded this it is required for the ADT plugin setup, e.g. C:Program Filesandroid-sdk-windowsplatform- tools> Useful for adb commands
  • 5. The ADT plugin Gives access to Android development tools from within the Eclipse IDE Automates the process of building a new Android project by setting up all the basic files needed for development Allows code signing of your app so it can be distributed
  • 6. Installing the ADT plugin (Link: http://developer.android.com/sdk/eclipse-adt.html#installing) To simplify ADT setup, it is recommend installing the Android SDK prior to installing ADT .Eclipse 3.5 (Galileo) and 3.6 (Helios) 1.Start Eclipse, then select Help>Install New Software.... 2.Click Add, in the top-right corner. 3.In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/ Note: If you have troubles try using "http" instead of "httpsClick OK. 4.In the Available Software dialog, select the checkbox next to Developer Tools and click Next. 5.In the next window, you'll see a list of the tools to be downloaded. Click Next. 6.Read and accept the license agreements, then click Finish. 7.When the installation completes, restart Eclipse.
  • 7. Configuring the ADT plugin 1.Select Window>Preferences...to open the Preferences panel (Mac OS X:Eclipse>Preferences). 2.Select Android from the left panel. 3.For the SDK Location in the main panel, click Browse...and locate your downloaded SDK directory (e.g. C:Program Filesandroid-sdk-windows) 4.Click Apply, then OK
  • 8. Android SDK and AVD manager Add your virtual development devices using this AVD is a target device simulator: no sensors
  • 10. Android SDK and AVD Manager Used for updating Android SDK tools etc.
  • 11. Pointers Update the systems PATH variable to recognize two folders inside your android-sdk-winwows. The first is: tools and the second is platform- tools. 1.Windows > Start > Control Panel > System > Advanced > Environment Variables > System Variables > PATH > Edit 2.Add references to the sub-folders mentioned above. In this example: c:android-sdk-windowstools;C:android-sdk-windowsplatform-tools; 3.OK Make sure Java and Eclipse Environments and path variables are setup correctly: Some interesting tutorials on Android projects can be found on: http://www.hometutorials.com/google-android.html
  • 15. Android Project Components Once you complete the New Project Wizard, ADT creates the following folders and files in your new project: src/ Includes your stub Activity Java file. All other Java files for your application go here. <Android Version>/ (e.g., Android 1.5/) Includes the android.jar file that your application will build against. gen/ This contains the Java files generated by ADT, such as your R.java file and interfaces created from AIDL files. assets/This is empty. You can use it to store raw asset files. res/A folder for your application resources, such as drawable files, layout files, string values, etc. AndroidManifest.xml The Android Manifest for your project. default.propertiesThis file contains project settings, such as the build target.
  • 29. Accessing Sensors There are various sensors on the Android phones, e.g. GPS, camera, accelerometer Cannot be tested on Simulator Tutorial and sample source code to use GPS and accelerometer sensors available soon Using the Wi-Fi and Bluetooth Interfaces instructions on: http://www.tutorialforandroid.com/2009/10/turn-off-turn-on-wifi-in-android-using.html http://developer.android.com/guide/topics/wireless/bluetooth.html
  • 30. GPS Sensor Access To use GPS functionality in your Android application, you'll need to add the ACCESS_FINE_LOCATION permission to the AndroidManifest.xml file. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> In Android, location-based services are provided by the LocationManager class located in the android.location package. Using the LocationManager class, your application can obtain periodic updates of the device's geographical locations as well as fire an intent when it enters the proximity of a certain location.
  • 31. Accelerometer and Access to other Sensors An instance of the SensorManager is required in order to retrieve informations about the supported sensors. No permission is required to access the sensor service. It is then possible to retrieve the list of available sensors of a certain type. For an accelerometer sensor, the type to use is given by the Sensor.TYPE_ACCELEROMETER constant. If at least one Sensor exists, it is possible to register a SensorEventListener for a Sensor of the list. It is possible to specify the delivering rate for sensor events. Specified rate must be one of :
  • 32. SensorManager.SENSOR_DELAY_FASTEST : as fast as possible SensorManager.SENSOR_DELAY_GAME : rate suitable for game SensorManager.SENSOR_DELAY_NORMAL : normal rate SensorManager.SENSOR_DELAY_UI : rate suitable for UI Thread
  • 33. Android and Databases Access to remote database e.g. MySQL can occur using a PHP script hosted on the server performing the query and JSON formatting for data exchange for reference check out the example at: http://www.helloandroid.com/tutorials/connecting- mysql-database Local light weight database system. http://developer.android.com/reference/android/d atabase/sqlite/SQLiteDatabase.html