SlideShare a Scribd company logo
presents:




Android Java J2EE Specialist




          Author of

available on




                               1
•Android in numbers


•Installing the work space


•Creating a project


•Using DDMS perspective


•Using DDMS perspective and Eclipse Debug Bridge


•Tracking memory leaks




                                                   2
Android Trainer Consultant Expert
                                     mathias.seguy.it@gmail.com (mail)
                                            @android2ee (twitter)
                        Author of eBooks on Android programming (Android2ee.com)
                                       Android Speaker and Teacher
                                     Fundamentals Mathematics Doctor
                         Technical expert of the ā€œAgence Nationale de la Rechercheā€
                                         Developpez.com Redactor
                      Android Blogs : Android2EE sur DVP et Android2ee sur BlogSpot
Fundamentals
 Mathematics                                                                                        Android2EE
    PHD                                 Via CapGemini                     Via Sopra                    Birth
        Siemens     Magnus        DGA        CNES        Airbus        Airbus      Airbus        STI         Android2
          VDO                                                                                                  EE
  03        04          05         06           07           08               09         10        11         12
                                                              Java J2EE
                                                                                                        Android
                                             Manager     Manager                               Technical
        Developer   Developer   GUI Leader   Technical   Technical     Manager     Technical    Director     Android2EE
                                              Leader      Leader                    Leader                    Founder


ENSEEIHTā€Ÿs IT                                                        At STI
   Master

                                                                                                                          3
4
•2003 Android Inc creation
•2005 Google bought Android
•2007 Open Handset Alliance birth
•2007 Android Beta SDK released




   In 3 years, from September 2008 to
   November 2011, 8 major versions of the
   system are delivered by Google



                                            5
Android in numbers:
•   27% of mobiles are smart phones (World Wild, 2011);
•   52.5% of smart phones are Android phones (World Wild, Dec 2011);
•   1 smart phone over two sold is an Android Phone (US, Dec 2011);
•   +17391% of available applications on GooglePlay in 3 years;
•   +500 000 applications in GooglePlay (April 2012);
•   +15 000 000 downloads (May 2012);
•   2012 will be the Android Tablet year.

Ok, today, Android is the smart phones OS winner.
But tomorrow, Android will be everywhere: mobile, tablet, TV, watches, Hifi, car, appliances, home automation
Everywhere, I tell you.




                                                                                                                6
7
Itā€Ÿs pretty easy:
First:
•       Download Java
       (http://www.oracle.com/technetwork/java/javase/do
       wnloads/index.html) and install it;
•      Download Eclipse
       (http://www.eclipse.org/downloads/) and install it;
•      Download the Android SDK
       (http://developer.android.com/sdk/index.html) and
       unzip it.

In Eclipse, add the Android plugin:
•    Go in Help/install New software. Click Add and
     set Android and https://dl-
     ssl.google.com/android/eclipse/
•    Select all the elements, click next and finish.

Restart Eclipse :
•    In WindowPreference select Android et set the
     Android SDK path (the folder in which you unzip
     the Android SDK)

Ok, itā€Ÿs done, you can code Android program.
Now open the SDK Manager

And launch the update/installation (Android SDK Tools,
     platform-tools, SDK, documentation,…).
A long download is waiting for you.




Then define Android Virtual Device (Emulator) for tests.
Now open the SDK Manager


A quick glance at the window.
Open the AVD window.
Open the AVD window.
Select new.
Define a new Emulator:
•    Name
•    Target
•    SD card size
•    Skin (resolution)
•    Hardware
13
Letā€Ÿs create a first project a see :
•     Android ā€œnew projectā€ Wizard
•     Android Manifest wysiwyg
•     Android Layout wysiwyg
•     Android resources wysiwyg




                                       14
Letā€Ÿs create a first project a see :
File->new->Others…-> Android Project and follow the wizard:
Project Name, Project SDK to target,




                                                              15
Letā€Ÿs create a first project a see :
File->new->Others…-> Android Project and follow the wizard:
Project Name, Project SDK to target, Application name, Package name, Activity name, min SDK,
Project created




                                                                                               16
17
18
19
20
Open the DDMS perspective.
•   Devices
•   Emulator Control
•   Set of action buttons
•   File Explorer
•   Resource explorer
•   Lint Warning
•   LogCat




                             21
Status   Version/Tid/Pid

Devices Connected




 Avaiable Processes
      to watch




                                                 22
Control the emulator telephony status




 Emulate a phone call to the emulator
  Emulate the reception of an SMS




Control the emulator geo-location using:
            Your own lat/long
               A GPX file
               A KML file




                                           23
Screen
                       Debug            Heap              Thread      Stop     Capture
                                                                                             Take a
                                                                                             screen
                                                                                              shoot



Strart the Ā« Debug Ā»                                                                       Stop a process
    on a Process
                                                                                           Begin CPU time
                     Begin the Heap             Cause Garbage                                 tracking
                   tracking using the          Collector usefull to
                       Heap View               update heap stats        Begin threads
                                                                      tracking using the
                                 Dump the Heap                          Threads View
                               within Eclipse (using
                                 MAT) or in a file




                                                                                                            24
Create a folder


   Delete a file


Push a file onto the
      device


Pull a file from the
      device




                       25
Ressources used by
                      the process




Selected process




                                        26
List all the problems found in the workspace, a PMD like dedicated to Android




Description                 Category            Location            Description of the rule




                                                                                              27
28
29
Using the Debug mode with
the DDMS perspective.
•    Allocation tracker
•    Heap tracking
•    Threads tracking
•    Heap Dump




                            30
31
32
33
34
35
Itā€Ÿs quiet simple:                                 Thread I.H.M                      Thread de traitement
Link an activity with a life cycle and a      Activity         Handler
      thread with no management                                                         sendMessage(
      between the thread lifecycle and the                                                   )

                                                              message


                                                         OnDestroy()
                                                         OnCreate()

                                                                                 Thread de traitement initiale

                                                  Thread I.H.M                           sendMessage
                                                                                              ()

                                              Activity        Handler
                                             fantƓme          fantƓme

                                                                                     Thread de traitement
                                             Activity          Handler
                                                                                         sendMessage(
                                                                                              )
                                                                       message




                                                                                                                 36
Application


 Main
Activity      Handler   Thread 1




                                   37
Application
 Main
Activity 1   Handler 1   Thread 1




 Main
Activity 2   Handler 2   Thread 2




                                    38
Application
 Main
Activity 1   Handler 1   Thread 1




 Main
Activity 2   Handler 2   Thread 2




 Main
Activity 3   Handler 3   Thread 3




                                    39
Shallow heap is the memory consumed by one object.                         GC Root
                                                                                     S=100
Retained set of X is the set of objects which would be                               R=400
removed by GC when X is garbage collected.

Retained heap of X is the sum of shallow sizes of all objects
in the retained set of X, i.e. memory kept alive by X.

Generally speaking, shallow heap of an object is its size in the
heap and retained size of the same object is the amount of         S=100                     S=100
heap memory that will be freed when the object is garbage          R=200                     R=100
collected.




                                                                   S=100
                                                                   R=100




                                                                                                     40
Using the Debug mode with
the DDMS perspective.
•    Allocation tracker
•    Heap tracking
•    Threads tracking
•    Heap Dump

•   Save the heap,
•   Convert the heap using: hpro-conv dump.hprof dump-converted.hprof
•   D:Eclipseeclipsex64_indigo_Androidandroid-sdktools>hprof-conv.exe
    D:AndroidConferenceEclipseDayToulousehrpofcom.android2ee.tuto.thread.orphan.hprof
    D:AndroidConferenceEclipseDayToulousehrpofcom.android2ee.tuto.thread.orphan.converted.prof




                                                                                                      41
•     Open it in MAT the converted hprof
    •    Dominator tree => We detect our Thread




                                                  42
•     Open it in MAT the converted hprof
    •    Dominator tree => We detect our Thread




                                                  43
•     Now, open the Histogram View
    •    Choose byte[] and select ā€œlist object with incoming referenceā€




                                                                          44
•     Now, open the Histogram View
    •    Choose byte[] and select ā€œlist object with incoming referenceā€
    •    Open the items and fall on your class and select ā€œlist object with incoming referenceā€




                                                                                                  45
•     Now, open the Histogram View
    •    Choose byte[] and select ā€œlist object with incoming referenceā€
    •    Open the items and fall on your class and select ā€œlist object with incoming referenceā€
    •    Find again the duplicated activity




                                                                                                  46
•     Now, open the Histogram View
    •    Choose byte[] and select ā€œlist object with incoming referenceā€
    •    Open the items and fall on your class and select ā€œlist object with incoming referenceā€
    •    Find again the duplicated activity
        Open one of then and Just look at the Handler and the Background Thread => Leak Resolved




                                                                                                    47
This presentation has used the following references:
           •     Android2eeā€žs Ebooks and tutorials : http://www.android2ee.com
           •     Android web sites:
                    •  http://developer.android.com/index.html
                    •  http://android-developers.blogspot.fr/
                    •  http://www.google.com/events/io/2011/sessions.html
           •     Android Design Guide: http://developer.android.com/design/index.html

On Android2ee, youā€Ÿll find the following tutorials:
                    •   Sensors
                    •   Threads, handlers and memory leaks
                    •   AppWidgets
                    •   Dynamic GUI creation
                    •   REST Services
                    •   RSS reader
                    •   Use Maven for Android projects
                    •   Deliver on GooglePlay

Sur developpez.com vous trouverez les articles suivants (franƧais seulement):
                    •DĆ©ployer son application Android et obtenir sa clef MapView.
                    •Construire dynamiquement ses IHM Android
                    •Les capteurs Android
                    •Thread, Handler, AsyncTask et fuites mĆ©moires
                    •Investir l'Ć©cran d'accueil Android avec les AppWidgets
                    •Android, Livrer son projet sur GooglePlay




                                                                                        48
.




                                 Thanks for your attention.


                                     android2ee.com.              See you in:
                                                                  Brazzaville
                                       #android2ee                In September
                                mathias.seguy.it@gmail.com
MySensors, MyLight et MyTorch
   available on GooglePlay

                                                                                 49

More Related Content

What's hot (6)

PPT
JavaYDL16
Terry Yoast
Ā 
PDF
GENERATOR V1.0 (Shenzhen)
HAX
Ā 
ODP
Android executable modeling: beyond android programming
Olivier Le Goaƫr
Ā 
PDF
Top Tips for Android UIs
Motorola Mobility - MOTODEV
Ā 
PDF
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
Alvaro Viebrantz
Ā 
DOCX
Local Notification Tutorial
Ketan Raval
Ā 
JavaYDL16
Terry Yoast
Ā 
GENERATOR V1.0 (Shenzhen)
HAX
Ā 
Android executable modeling: beyond android programming
Olivier Le Goaƫr
Ā 
Top Tips for Android UIs
Motorola Mobility - MOTODEV
Ā 
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
Alvaro Viebrantz
Ā 
Local Notification Tutorial
Ketan Raval
Ā 

Viewers also liked (14)

PPTX
ConfƩrence "Architecture Android" du 19 Mars 2013 par Mathias Seguy fondateur...
Mathias Seguy
Ā 
PPTX
Mise en place de l'ActionBarCompat dans vos projets Android.
Mathias Seguy
Ā 
PPTX
Android un nouveau futur s'ouvre Ć  nous
Mathias Seguy
Ā 
PPTX
CocoaHeads An Android Overview (fr)
Mathias Seguy
Ā 
PPTX
Treatment, Architecture and Threads
Mathias Seguy
Ā 
PPTX
Architecture et Bonnes pratiques Android #DevoxxFr2016 Part2
Mathias Seguy
Ā 
PPTX
Animate Me! if you don't do it for me, do it for Chet - DroidconLondon2015
Mathias Seguy
Ā 
PDF
The 2016 Android Developer Toolbox [NANTES]
Nilhcem
Ā 
PPTX
Voyage en monde Android. Trucs et astuces tout au long de la route.
Mathias Seguy
Ā 
PPTX
Animate Me, if you don't do it for me do it for chet (DroidCon Paris)
Mathias Seguy
Ā 
PPTX
Android2EE training: Tutorials list of Android projects
Mathias Seguy
Ā 
PPTX
Animate me, If you don't do it for me do it for Chet :)
Mathias Seguy
Ā 
PPTX
PrƩsentation et bonnes pratiques du pattern MVVM - MIC Belgique
Denis Voituron
Ā 
PPTX
Architecture et Bonnes pratiques Android #DevoxxFr2016 Part1
Mathias Seguy
Ā 
ConfƩrence "Architecture Android" du 19 Mars 2013 par Mathias Seguy fondateur...
Mathias Seguy
Ā 
Mise en place de l'ActionBarCompat dans vos projets Android.
Mathias Seguy
Ā 
Android un nouveau futur s'ouvre Ć  nous
Mathias Seguy
Ā 
CocoaHeads An Android Overview (fr)
Mathias Seguy
Ā 
Treatment, Architecture and Threads
Mathias Seguy
Ā 
Architecture et Bonnes pratiques Android #DevoxxFr2016 Part2
Mathias Seguy
Ā 
Animate Me! if you don't do it for me, do it for Chet - DroidconLondon2015
Mathias Seguy
Ā 
The 2016 Android Developer Toolbox [NANTES]
Nilhcem
Ā 
Voyage en monde Android. Trucs et astuces tout au long de la route.
Mathias Seguy
Ā 
Animate Me, if you don't do it for me do it for chet (DroidCon Paris)
Mathias Seguy
Ā 
Android2EE training: Tutorials list of Android projects
Mathias Seguy
Ā 
Animate me, If you don't do it for me do it for Chet :)
Mathias Seguy
Ā 
PrƩsentation et bonnes pratiques du pattern MVVM - MIC Belgique
Denis Voituron
Ā 
Architecture et Bonnes pratiques Android #DevoxxFr2016 Part1
Mathias Seguy
Ā 
Ad

Similar to Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_slideshare (20)

PDF
Profiling Android Applications
hubx
Ā 
PDF
An Introduction To Android
natdefreitas
Ā 
PPTX
Ii 1300-java essentials for android
Adrian Mikeliunas
Ā 
PPT
Getting started with android dev and test perspective
Gunjan Kumar
Ā 
PDF
Introduction to Android App Development
Andri Yadi
Ā 
PDF
Improve Android System Component Performance
National Cheng Kung University
Ā 
PPTX
Android ppt
Pooja Garg
Ā 
PPT
Android app developers in bangalore- thorsignia
charan Teja
Ā 
PPT
Android My Seminar
Ganesh Waghmare
Ā 
PDF
Guides To Analyzing WebKit Performance
National Cheng Kung University
Ā 
PPTX
Introduction to android
zeelpatel0504
Ā 
PDF
Android Attacks
Michael Scovetta
Ā 
PPT
PPT Companion to Android
Dharani Kumar Madduri
Ā 
KEY
Android Development: The Basics
Mike Desjardins
Ā 
PPTX
Session 2 beccse
vin123456gangal
Ā 
PPT
Build Mobile Application In Android
dnnddane
Ā 
PDF
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
Vando Batista
Ā 
PDF
Google Android @ AlphaCSP's JavaEdge
yuvalb
Ā 
PDF
Slides bootcamp21
dxsaki
Ā 
PPTX
OS in mobile devices [Android]
Yatharth Aggarwal
Ā 
Profiling Android Applications
hubx
Ā 
An Introduction To Android
natdefreitas
Ā 
Ii 1300-java essentials for android
Adrian Mikeliunas
Ā 
Getting started with android dev and test perspective
Gunjan Kumar
Ā 
Introduction to Android App Development
Andri Yadi
Ā 
Improve Android System Component Performance
National Cheng Kung University
Ā 
Android ppt
Pooja Garg
Ā 
Android app developers in bangalore- thorsignia
charan Teja
Ā 
Android My Seminar
Ganesh Waghmare
Ā 
Guides To Analyzing WebKit Performance
National Cheng Kung University
Ā 
Introduction to android
zeelpatel0504
Ā 
Android Attacks
Michael Scovetta
Ā 
PPT Companion to Android
Dharani Kumar Madduri
Ā 
Android Development: The Basics
Mike Desjardins
Ā 
Session 2 beccse
vin123456gangal
Ā 
Build Mobile Application In Android
dnnddane
Ā 
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
Vando Batista
Ā 
Google Android @ AlphaCSP's JavaEdge
yuvalb
Ā 
Slides bootcamp21
dxsaki
Ā 
OS in mobile devices [Android]
Yatharth Aggarwal
Ā 
Ad

Recently uploaded (20)

PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
Ā 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
Ā 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
Ā 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
Ā 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
PDF
The Future of Artificial Intelligence (AI)
Mukul
Ā 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
Ā 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
Ā 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
Ā 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
Ā 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
Ā 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
Ā 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
Ā 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
Ā 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
Ā 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
Ā 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
Ā 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
Ā 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
Ā 
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
Ā 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
Ā 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
The Future of Artificial Intelligence (AI)
Mukul
Ā 
Per Axbom: The spectacular lies of maps
Nexer Digital
Ā 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
Ā 
Brief History of Internet - Early Days of Internet
sutharharshit158
Ā 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
Ā 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
Ā 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
Ā 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
Ā 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
Ā 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
Ā 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
Ā 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
Ā 

Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_slideshare

  • 1. presents: Android Java J2EE Specialist Author of available on 1
  • 2. •Android in numbers •Installing the work space •Creating a project •Using DDMS perspective •Using DDMS perspective and Eclipse Debug Bridge •Tracking memory leaks 2
  • 3. Android Trainer Consultant Expert [email protected] (mail) @android2ee (twitter) Author of eBooks on Android programming (Android2ee.com) Android Speaker and Teacher Fundamentals Mathematics Doctor Technical expert of the ā€œAgence Nationale de la Rechercheā€ Developpez.com Redactor Android Blogs : Android2EE sur DVP et Android2ee sur BlogSpot Fundamentals Mathematics Android2EE PHD Via CapGemini Via Sopra Birth Siemens Magnus DGA CNES Airbus Airbus Airbus STI Android2 VDO EE 03 04 05 06 07 08 09 10 11 12 Java J2EE Android Manager Manager Technical Developer Developer GUI Leader Technical Technical Manager Technical Director Android2EE Leader Leader Leader Founder ENSEEIHTā€Ÿs IT At STI Master 3
  • 4. 4
  • 5. •2003 Android Inc creation •2005 Google bought Android •2007 Open Handset Alliance birth •2007 Android Beta SDK released In 3 years, from September 2008 to November 2011, 8 major versions of the system are delivered by Google 5
  • 6. Android in numbers: • 27% of mobiles are smart phones (World Wild, 2011); • 52.5% of smart phones are Android phones (World Wild, Dec 2011); • 1 smart phone over two sold is an Android Phone (US, Dec 2011); • +17391% of available applications on GooglePlay in 3 years; • +500 000 applications in GooglePlay (April 2012); • +15 000 000 downloads (May 2012); • 2012 will be the Android Tablet year. Ok, today, Android is the smart phones OS winner. But tomorrow, Android will be everywhere: mobile, tablet, TV, watches, Hifi, car, appliances, home automation Everywhere, I tell you. 6
  • 7. 7
  • 8. Itā€Ÿs pretty easy: First: • Download Java (http://www.oracle.com/technetwork/java/javase/do wnloads/index.html) and install it; • Download Eclipse (http://www.eclipse.org/downloads/) and install it; • Download the Android SDK (http://developer.android.com/sdk/index.html) and unzip it. In Eclipse, add the Android plugin: • Go in Help/install New software. Click Add and set Android and https://dl- ssl.google.com/android/eclipse/ • Select all the elements, click next and finish. Restart Eclipse : • In WindowPreference select Android et set the Android SDK path (the folder in which you unzip the Android SDK) Ok, itā€Ÿs done, you can code Android program.
  • 9. Now open the SDK Manager And launch the update/installation (Android SDK Tools, platform-tools, SDK, documentation,…). A long download is waiting for you. Then define Android Virtual Device (Emulator) for tests.
  • 10. Now open the SDK Manager A quick glance at the window.
  • 11. Open the AVD window.
  • 12. Open the AVD window. Select new. Define a new Emulator: • Name • Target • SD card size • Skin (resolution) • Hardware
  • 13. 13
  • 14. Letā€Ÿs create a first project a see : • Android ā€œnew projectā€ Wizard • Android Manifest wysiwyg • Android Layout wysiwyg • Android resources wysiwyg 14
  • 15. Letā€Ÿs create a first project a see : File->new->Others…-> Android Project and follow the wizard: Project Name, Project SDK to target, 15
  • 16. Letā€Ÿs create a first project a see : File->new->Others…-> Android Project and follow the wizard: Project Name, Project SDK to target, Application name, Package name, Activity name, min SDK, Project created 16
  • 17. 17
  • 18. 18
  • 19. 19
  • 20. 20
  • 21. Open the DDMS perspective. • Devices • Emulator Control • Set of action buttons • File Explorer • Resource explorer • Lint Warning • LogCat 21
  • 22. Status Version/Tid/Pid Devices Connected Avaiable Processes to watch 22
  • 23. Control the emulator telephony status Emulate a phone call to the emulator Emulate the reception of an SMS Control the emulator geo-location using: Your own lat/long A GPX file A KML file 23
  • 24. Screen Debug Heap Thread Stop Capture Take a screen shoot Strart the Ā« Debug Ā» Stop a process on a Process Begin CPU time Begin the Heap Cause Garbage tracking tracking using the Collector usefull to Heap View update heap stats Begin threads tracking using the Dump the Heap Threads View within Eclipse (using MAT) or in a file 24
  • 25. Create a folder Delete a file Push a file onto the device Pull a file from the device 25
  • 26. Ressources used by the process Selected process 26
  • 27. List all the problems found in the workspace, a PMD like dedicated to Android Description Category Location Description of the rule 27
  • 28. 28
  • 29. 29
  • 30. Using the Debug mode with the DDMS perspective. • Allocation tracker • Heap tracking • Threads tracking • Heap Dump 30
  • 31. 31
  • 32. 32
  • 33. 33
  • 34. 34
  • 35. 35
  • 36. Itā€Ÿs quiet simple: Thread I.H.M Thread de traitement Link an activity with a life cycle and a Activity Handler thread with no management sendMessage( between the thread lifecycle and the ) message OnDestroy() OnCreate() Thread de traitement initiale Thread I.H.M sendMessage () Activity Handler fantĆ“me fantĆ“me Thread de traitement Activity Handler sendMessage( ) message 36
  • 37. Application Main Activity Handler Thread 1 37
  • 38. Application Main Activity 1 Handler 1 Thread 1 Main Activity 2 Handler 2 Thread 2 38
  • 39. Application Main Activity 1 Handler 1 Thread 1 Main Activity 2 Handler 2 Thread 2 Main Activity 3 Handler 3 Thread 3 39
  • 40. Shallow heap is the memory consumed by one object. GC Root S=100 Retained set of X is the set of objects which would be R=400 removed by GC when X is garbage collected. Retained heap of X is the sum of shallow sizes of all objects in the retained set of X, i.e. memory kept alive by X. Generally speaking, shallow heap of an object is its size in the heap and retained size of the same object is the amount of S=100 S=100 heap memory that will be freed when the object is garbage R=200 R=100 collected. S=100 R=100 40
  • 41. Using the Debug mode with the DDMS perspective. • Allocation tracker • Heap tracking • Threads tracking • Heap Dump • Save the heap, • Convert the heap using: hpro-conv dump.hprof dump-converted.hprof • D:Eclipseeclipsex64_indigo_Androidandroid-sdktools>hprof-conv.exe D:AndroidConferenceEclipseDayToulousehrpofcom.android2ee.tuto.thread.orphan.hprof D:AndroidConferenceEclipseDayToulousehrpofcom.android2ee.tuto.thread.orphan.converted.prof 41
  • 42. • Open it in MAT the converted hprof • Dominator tree => We detect our Thread 42
  • 43. • Open it in MAT the converted hprof • Dominator tree => We detect our Thread 43
  • 44. • Now, open the Histogram View • Choose byte[] and select ā€œlist object with incoming referenceā€ 44
  • 45. • Now, open the Histogram View • Choose byte[] and select ā€œlist object with incoming referenceā€ • Open the items and fall on your class and select ā€œlist object with incoming referenceā€ 45
  • 46. • Now, open the Histogram View • Choose byte[] and select ā€œlist object with incoming referenceā€ • Open the items and fall on your class and select ā€œlist object with incoming referenceā€ • Find again the duplicated activity 46
  • 47. • Now, open the Histogram View • Choose byte[] and select ā€œlist object with incoming referenceā€ • Open the items and fall on your class and select ā€œlist object with incoming referenceā€ • Find again the duplicated activity  Open one of then and Just look at the Handler and the Background Thread => Leak Resolved 47
  • 48. This presentation has used the following references: • Android2eeā€žs Ebooks and tutorials : http://www.android2ee.com • Android web sites: • http://developer.android.com/index.html • http://android-developers.blogspot.fr/ • http://www.google.com/events/io/2011/sessions.html • Android Design Guide: http://developer.android.com/design/index.html On Android2ee, youā€Ÿll find the following tutorials: • Sensors • Threads, handlers and memory leaks • AppWidgets • Dynamic GUI creation • REST Services • RSS reader • Use Maven for Android projects • Deliver on GooglePlay Sur developpez.com vous trouverez les articles suivants (franƧais seulement): •DĆ©ployer son application Android et obtenir sa clef MapView. •Construire dynamiquement ses IHM Android •Les capteurs Android •Thread, Handler, AsyncTask et fuites mĆ©moires •Investir l'Ć©cran d'accueil Android avec les AppWidgets •Android, Livrer son projet sur GooglePlay 48
  • 49. . Thanks for your attention. android2ee.com. See you in: Brazzaville #android2ee In September [email protected] MySensors, MyLight et MyTorch available on GooglePlay 49