SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Android application
development basics
     Anton Narusberg
Hello, I’m Anton.

• Developer since 2006
• Android developer since 2010
• Partner at Cannedapps
Topics

• Getting up and running with Android SDK
• "Hello World!"
• Deeper dive into Android application
  components
Android SDK
• Speed, Power, Control
• Standardized user experience
• Ability to be on the edge
• Integration
Getting started

• Java Development Kit (JDK)
• IDE (Eclipse recommended)
• Android SDK
• Android Development Tools (ADT)
ADT plugin for Eclipse
• SDK Tools Integration
• Code Editors
• Layout Refactoring Support
• Android Virtual Devices Manager
• DDMS
• ...
more at http://developer.android.com/guide/developing/tools/adt.html
“Hello eSport!”
Android application
         components

• Activity
• Layouts & Views
• Service
• Intent
• AndroidManifest.xml
Activity
Activity
UI concept that represents a single screen on your app
Activity
UI concept that represents a single screen on your app




DashboardActivity                TrainingActivity
Activity lifecycle
DashboardActivity
public class DashboardActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.dashboard);

        preferences = PreferenceManager.getDefaultSharedPreferences(this);

        initViews();
        initShadows();
        attachEvents();
    }

    @Override
    protected void onResume() {
      shadower.turnOn();
      super.onResume();
    }

    @Override
    protected void onPause() {
      shadower.turnOff();
      super.onPause();
    }

    ....

}
Dashboard layout
Dashboard layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/background_gradient">

  <ImageView
    android:layout_width="40dp"
    android:layout_height="36dp"
    android:layout_marginTop="18dp"
    android:layout_marginLeft="15dp"
    android:background="@drawable/logo_run"/>



  <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="170dp"
    android:layout_alignParentBottom="true">

    <ImageView
      android:id="@+id/dashboard_history_button_shadow"
      android:layout_width="100dp"
      android:layout_height="97dp"
      android:layout_marginLeft="110dp"
      android:background="@drawable/menu_history_shadow"/>

    <Button
      android:id="@+id/dashboard_history_button"
      android:layout_width="100dp"
      android:layout_height="97dp"
      android:layout_marginLeft="110dp"
      android:background="@drawable/menu_history"/>

    .......

  </RelativeLayout>

</RelativeLayout>
Service
Background process that can run for a long time
Service
Background process that can run for a long time
Binding the Service from Activity
public class TrainingActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate();
      Intent intent = new Intent(this, RunningSessionService.class);
      bindService(intent, sessionConnection, BIND_AUTO_CREATE);
    }

    @Override
    protected void onDestroy() {
      unbindService(sessionConnection);
      super.onDestroy();
    }

    private ServiceConnection sessionConnection = new ServiceConnection() {

         public void onServiceDisconnected(ComponentName name) {}

         public void onServiceConnected(ComponentName name, IBinder serviceBinding) {
           RunningSessionService.SessionBinder binding = (RunningSessionService.SessionBinder) serviceBinding;
           session = binding.getService();
         }
    };

    public void onStartTrackingClicked() {
      if (session != null) {
        session.startTracking();
      }
    }

}
Binding the Service from Activity
public class RunningSessionService extends Service {

    @Override
    public void onCreate() {
      super.onCreate();
      init();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {}

    @Override
    public void onDestroy() {}

    @Override
    public IBinder onBind(Intent intent) {
      binding = new SessionBinder(this);
      return binding;
    }

    @Override
    public boolean onUnbind(Intent intent) {
      stopSelf();
      return super.onUnbind(intent);
    }

    public void startTracking() {
      ...
    }

    public void stopTracking() {
      ...
    }
}
Intent


•   An "intention" to do some work:

    •   Broadcast a message

    •   Start a Service

    •   Launch an Activity

    •   Display a web page or a list of contacts

    •   dial a phone nr. or answer a call

    •   etc.
Launching next Activity with an Intent




DashboardActivity         TrainingActivity
Intent
public class DashboardActivity extends Activity {

    private void initViews() {
      runButton = (Button) findViewById(R.id.dashboard_run_button);
      historyButton = (Button) findViewById(R.id.dashboard_history_button);
    }

    private void attachEvents() {
      runButton.setOnClickListener(new View.OnClickListener() {

          public void onClick(View v) {
            Intent intent = new Intent(DashboardActivity.this, SelectTrackActivity.class);
            startActivity(intent);
          }
        });

        ...

    }

    ...

}
AndroidManifest.xml
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.cannedapps.runner"
  android:versionCode="1"
  android:versionName="1.0">

  <uses-sdk android:minSdkVersion="3"/>

  <application
    android:name="Runner"
    android:label="@string/app_name"
    android:icon="@drawable/ic_launcher_run"
    android:theme="@android:style/Theme.NoTitleBar">

    <activity
      android:name="DashboardActivity"
      android:label="@string/app_name"
      android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name=".SettingsActivity"/>
    <activity
      android:name="TracksActivity"
      android:screenOrientation="portrait"/>
      ...

    <service android:enabled="true" android:name=".tracking.RunningSessionService"/>
  </application>

  <uses-permission   android:name="android.permission.INTERNET"/>
  <uses-permission   android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission   android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-permission   android:name="android.permission.WAKE_LOCK"/>

</manifest>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.cannedapps.runner"
  android:versionCode="1"
  android:versionName="1.0">

  <uses-sdk android:minSdkVersion="3"/>

  <application
    android:name="Runner"
    android:label="@string/app_name"                                                   Describe Activities & Services
    android:icon="@drawable/ic_launcher_run"
    android:theme="@android:style/Theme.NoTitleBar">

    <activity
      android:name="DashboardActivity"
      android:label="@string/app_name"
      android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name=".SettingsActivity"/>
    <activity
      android:name="TracksActivity"
      android:screenOrientation="portrait"/>
      ...

    <service android:enabled="true" android:name=".tracking.RunningSessionService"/>
  </application>
                                                                                           Describe Permissions
  <uses-permission   android:name="android.permission.INTERNET"/>
  <uses-permission   android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission   android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-permission   android:name="android.permission.WAKE_LOCK"/>

</manifest>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"                        General setup
  package="com.cannedapps.runner"
  android:versionCode="1"
  android:versionName="1.0">

  <uses-sdk android:minSdkVersion="3"/>

  <application
    android:name="Runner"
    android:label="@string/app_name"                                                   Describe Activities & Services
    android:icon="@drawable/ic_launcher_run"
    android:theme="@android:style/Theme.NoTitleBar">

    <activity
      android:name="DashboardActivity"
      android:label="@string/app_name"
      android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name=".SettingsActivity"/>
    <activity
      android:name="TracksActivity"
      android:screenOrientation="portrait"/>
      ...

    <service android:enabled="true" android:name=".tracking.RunningSessionService"/>
  </application>
                                                                                           Describe Permissions
  <uses-permission   android:name="android.permission.INTERNET"/>
  <uses-permission   android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission   android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-permission   android:name="android.permission.WAKE_LOCK"/>

</manifest>
Publishing to the Market

1. Sign up at https://market.android.com/publish
     - 25$ fee

2. Prepare your application Package
    - Test it
    - Build it
    - Sign it

3. Upload promotional material

4. Publish
Questions?

   Anton Narusberg
anton@cannedapps.com
   @antonnarusberg
Resources
Android resources
http://developer.android.com


Android Developers Google group
http://groups.google.com/group/android-developers


Online Tutorials
http://anddev.org
Community

           Tallinn Android Developers




http://www.meetup.com/Tallinn-Android-Developers/

Weitere ähnliche Inhalte

Was ist angesagt?

Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017Ivo Neskovic
 
Basic android development
Basic android developmentBasic android development
Basic android developmentUpanya Singh
 
Android development orientation for starters v2
Android development orientation for starters v2Android development orientation for starters v2
Android development orientation for starters v2Joemarie Amparo
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfacesC.o. Nieto
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKGun Lee
 
Android Development
Android DevelopmentAndroid Development
Android Developmentmclougm4
 
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceParesh Mayani
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentRaman Pandey
 
Five android architecture
Five android architectureFive android architecture
Five android architectureTomislav Homan
 
Android application development workshop day1
Android application development workshop   day1Android application development workshop   day1
Android application development workshop day1Borhan Otour
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cyclemssaman
 
Android architecture
Android architecture Android architecture
Android architecture Trong-An Bui
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A NutshellTed Chien
 

Was ist angesagt? (20)

Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017
 
Basic android development
Basic android developmentBasic android development
Basic android development
 
Android development orientation for starters v2
Android development orientation for starters v2Android development orientation for starters v2
Android development orientation for starters v2
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDK
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Android Development
Android DevelopmentAndroid Development
Android Development
 
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving Performance
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Ppt 2 android_basics
Ppt 2 android_basicsPpt 2 android_basics
Ppt 2 android_basics
 
Android Components
Android ComponentsAndroid Components
Android Components
 
Five android architecture
Five android architectureFive android architecture
Five android architecture
 
Android application development workshop day1
Android application development workshop   day1Android application development workshop   day1
Android application development workshop day1
 
Ch2 first app
Ch2 first appCh2 first app
Ch2 first app
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
Android xml-based layouts-chapter5
Android xml-based layouts-chapter5Android xml-based layouts-chapter5
Android xml-based layouts-chapter5
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
 
Android architecture
Android architecture Android architecture
Android architecture
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 

Ähnlich wie Android app development basics

android level 3
android level 3android level 3
android level 3DevMix
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Eliran Eliassy
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - AndroidWingston
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesMichael Galpin
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...mharkus
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screenMatteo Bonifazi
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Mario Jorge Pereira
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android DevelopersJosiah Renaudin
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Alfredo Morresi
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Android N Highligts
Android N HighligtsAndroid N Highligts
Android N HighligtsSercan Yusuf
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談awonwon
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development PracticesRoy Clarkson
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverIntroducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverSpike Brehm
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdfImranS18
 

Ähnlich wie Android app development basics (20)

android level 3
android level 3android level 3
android level 3
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and Smartphones
 
Android classes in mumbai
Android classes in mumbaiAndroid classes in mumbai
Android classes in mumbai
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
 
Mini curso Android
Mini curso AndroidMini curso Android
Mini curso Android
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
 
Android N Highligts
Android N HighligtsAndroid N Highligts
Android N Highligts
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談
 
Android in practice
Android in practiceAndroid in practice
Android in practice
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverIntroducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and server
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
 

Kürzlich hochgeladen

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Kürzlich hochgeladen (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

Android app development basics

  • 2. Hello, I’m Anton. • Developer since 2006 • Android developer since 2010 • Partner at Cannedapps
  • 3. Topics • Getting up and running with Android SDK • "Hello World!" • Deeper dive into Android application components
  • 5. • Speed, Power, Control • Standardized user experience • Ability to be on the edge • Integration
  • 6. Getting started • Java Development Kit (JDK) • IDE (Eclipse recommended) • Android SDK • Android Development Tools (ADT)
  • 7. ADT plugin for Eclipse • SDK Tools Integration • Code Editors • Layout Refactoring Support • Android Virtual Devices Manager • DDMS • ... more at http://developer.android.com/guide/developing/tools/adt.html
  • 9. Android application components • Activity • Layouts & Views • Service • Intent • AndroidManifest.xml
  • 11. Activity UI concept that represents a single screen on your app
  • 12. Activity UI concept that represents a single screen on your app DashboardActivity TrainingActivity
  • 14. DashboardActivity public class DashboardActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dashboard); preferences = PreferenceManager.getDefaultSharedPreferences(this); initViews(); initShadows(); attachEvents(); } @Override protected void onResume() { shadower.turnOn(); super.onResume(); } @Override protected void onPause() { shadower.turnOff(); super.onPause(); } .... }
  • 16. Dashboard layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background_gradient"> <ImageView android:layout_width="40dp" android:layout_height="36dp" android:layout_marginTop="18dp" android:layout_marginLeft="15dp" android:background="@drawable/logo_run"/> <RelativeLayout android:layout_width="fill_parent" android:layout_height="170dp" android:layout_alignParentBottom="true"> <ImageView android:id="@+id/dashboard_history_button_shadow" android:layout_width="100dp" android:layout_height="97dp" android:layout_marginLeft="110dp" android:background="@drawable/menu_history_shadow"/> <Button android:id="@+id/dashboard_history_button" android:layout_width="100dp" android:layout_height="97dp" android:layout_marginLeft="110dp" android:background="@drawable/menu_history"/> ....... </RelativeLayout> </RelativeLayout>
  • 17. Service Background process that can run for a long time
  • 18. Service Background process that can run for a long time
  • 19. Binding the Service from Activity public class TrainingActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(); Intent intent = new Intent(this, RunningSessionService.class); bindService(intent, sessionConnection, BIND_AUTO_CREATE); } @Override protected void onDestroy() { unbindService(sessionConnection); super.onDestroy(); } private ServiceConnection sessionConnection = new ServiceConnection() { public void onServiceDisconnected(ComponentName name) {} public void onServiceConnected(ComponentName name, IBinder serviceBinding) { RunningSessionService.SessionBinder binding = (RunningSessionService.SessionBinder) serviceBinding; session = binding.getService(); } }; public void onStartTrackingClicked() { if (session != null) { session.startTracking(); } } }
  • 20. Binding the Service from Activity public class RunningSessionService extends Service { @Override public void onCreate() { super.onCreate(); init(); } @Override public int onStartCommand(Intent intent, int flags, int startId) {} @Override public void onDestroy() {} @Override public IBinder onBind(Intent intent) { binding = new SessionBinder(this); return binding; } @Override public boolean onUnbind(Intent intent) { stopSelf(); return super.onUnbind(intent); } public void startTracking() { ... } public void stopTracking() { ... } }
  • 21. Intent • An "intention" to do some work: • Broadcast a message • Start a Service • Launch an Activity • Display a web page or a list of contacts • dial a phone nr. or answer a call • etc.
  • 22. Launching next Activity with an Intent DashboardActivity TrainingActivity
  • 23. Intent public class DashboardActivity extends Activity { private void initViews() { runButton = (Button) findViewById(R.id.dashboard_run_button); historyButton = (Button) findViewById(R.id.dashboard_history_button); } private void attachEvents() { runButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(DashboardActivity.this, SelectTrackActivity.class); startActivity(intent); } }); ... } ... }
  • 25. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.cannedapps.runner" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="3"/> <application android:name="Runner" android:label="@string/app_name" android:icon="@drawable/ic_launcher_run" android:theme="@android:style/Theme.NoTitleBar"> <activity android:name="DashboardActivity" android:label="@string/app_name" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SettingsActivity"/> <activity android:name="TracksActivity" android:screenOrientation="portrait"/> ... <service android:enabled="true" android:name=".tracking.RunningSessionService"/> </application> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> </manifest>
  • 26. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.cannedapps.runner" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="3"/> <application android:name="Runner" android:label="@string/app_name" Describe Activities & Services android:icon="@drawable/ic_launcher_run" android:theme="@android:style/Theme.NoTitleBar"> <activity android:name="DashboardActivity" android:label="@string/app_name" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SettingsActivity"/> <activity android:name="TracksActivity" android:screenOrientation="portrait"/> ... <service android:enabled="true" android:name=".tracking.RunningSessionService"/> </application> Describe Permissions <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> </manifest>
  • 27. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" General setup package="com.cannedapps.runner" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="3"/> <application android:name="Runner" android:label="@string/app_name" Describe Activities & Services android:icon="@drawable/ic_launcher_run" android:theme="@android:style/Theme.NoTitleBar"> <activity android:name="DashboardActivity" android:label="@string/app_name" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SettingsActivity"/> <activity android:name="TracksActivity" android:screenOrientation="portrait"/> ... <service android:enabled="true" android:name=".tracking.RunningSessionService"/> </application> Describe Permissions <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> </manifest>
  • 28. Publishing to the Market 1. Sign up at https://market.android.com/publish - 25$ fee 2. Prepare your application Package - Test it - Build it - Sign it 3. Upload promotional material 4. Publish
  • 29. Questions? Anton Narusberg anton@cannedapps.com @antonnarusberg
  • 30. Resources Android resources http://developer.android.com Android Developers Google group http://groups.google.com/group/android-developers Online Tutorials http://anddev.org
  • 31. Community Tallinn Android Developers http://www.meetup.com/Tallinn-Android-Developers/

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n