SlideShare a Scribd company logo
1 of 3
Download to read offline
Mobile Application Development
T. S. Indi, IT Department, WIT Solapur Page 1
Hadnout#4
Problem Statement: Design and implement Calculator (Arithmetic
Operations) App using AsyncTask concept.
Theory:
Use of AsyncTask:
Use of AsyncTask is to run tasks, which consists computationally
intensive operations, asynchronously from the UI threads.
Need of AsyncTask:
Implementing multithreading if multiple threads are involved in
updating the UI is more tedious. This can be done with simple mechanism
provided in Android is called AsyncTask.
AsyncTask (Asynchronous Task)
 It enables proper and easy use of the UI thread.
 It allow to perform background operations and publish results on
the UI thread without having to manipulate threads and/or
handlers.
 It is designed to be a helper class around Thread and Handler and
does not constitute a generic threading framework.
 It should ideally be used for short operations (a few seconds at the
most.)
 It is defined by a computation that runs on a background thread
and whose result is published on the UI thread.
 It is defined by 3 generic types, called Params, Progress and Result,
and 4 steps, called onPreExecute, doInBackground,
onProgressUpdate and onPostExecute.
Mobile Application Development
T. S. Indi, IT Department, WIT Solapur Page 2
AsyncTask deals with two key aspects:
(1) Execute the long-running task in the background (in a separate
thread)
Callback method: doInBackground(Params params..)
(2) Update the main thread as the task progresses or completes.
Callback method: onProgressUpdate(Progress… progress)
To meet above key aspects, AsyncTask class provides two key callback
methods:
(1) doInBackground(Params params…)
Gets executed on a separate thread in the background, different from
main thread.
is an ideal place for long-running tasks
(2) onProgressUpdate(Progress… progress)
Gets executed on the main thread
is suited to update the progress of the background task on UI.
(3) publishProgress(params)
Gets executed inside doInBackground(Params params…) method.
Helps to establish asynochronous communication between the
doInBackground () and onProgressUpdate()
An AsyncTask is implemented as a nested class of an Activity whose
UI it needs to Update.
[Reference: Book -“Mobile Apps Development” by Anubhav Pradhan, Anil V Deshpande]
Mobile Application Development
T. S. Indi, IT Department, WIT Solapur Page 3
Design:
Steps:
1) Design an app to perform Arithmetic Operations such as Addition,
Subtraction and Multiplication for integer numbers.
2) Design layout with two TextView, two EditText, three TextView to
display results and “Submit” button.
3) User enters two numbers and click on “Submit” button.
4) On click of “Submit” button, two numbers passed to Asynchronous
Task thread to perform Addition, Subtraction and Multiplication of
two numbers.
5) Results performed in AsyncTask will be updated on main layout.
Questions:
1) What is asynTask in Android?
2) Illustrate the benefits of AsyncTask over Threads for implementing
long-running tasks.
3) Difference between AsyncTask & Handler in Android.
4) Explain concept of Handler & Looper in Android.
5) Explain event-handling paradigm with the help of example.

More Related Content

What's hot

Android application project presentation.
Android application project presentation.Android application project presentation.
Android application project presentation.Eyakub Sorkar
 
5 beginner android application development foundation
5 beginner android application development foundation5 beginner android application development foundation
5 beginner android application development foundationCbitss Technologies
 
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash ScreenMobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash ScreenAndiNurkholis1
 
Android app ppt
Android app pptAndroid app ppt
Android app pptADI ADARSH
 
Android task manager project presentation
Android task manager project presentationAndroid task manager project presentation
Android task manager project presentationAkhilesh Jaiswal
 
Iterative development & rational unified process
Iterative development &  rational unified processIterative development &  rational unified process
Iterative development & rational unified processpoonam bora
 
Making Android Easier to Develop
Making Android Easier to DevelopMaking Android Easier to Develop
Making Android Easier to DevelopSercan Yusuf
 
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, TimerMobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, TimerAndiNurkholis1
 
Application for Data Sync Between Different geo Locations
Application for Data Sync Between Different geo LocationsApplication for Data Sync Between Different geo Locations
Application for Data Sync Between Different geo LocationsMike Taylor
 
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...
Introduction to  Android   Programming by  Dr.M.Pyingkodi-kongu engineering c...Introduction to  Android   Programming by  Dr.M.Pyingkodi-kongu engineering c...
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...pyingkodi maran
 
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARIMOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARISivaSankari36
 
Difference between system software and application software
Difference between system software and application softwareDifference between system software and application software
Difference between system software and application softwareSujon Kumar Dey
 
Real-time Text Audio to Video PPT Converter Tablet App
Real-time Text Audio to Video PPT Converter Tablet AppReal-time Text Audio to Video PPT Converter Tablet App
Real-time Text Audio to Video PPT Converter Tablet AppMike Taylor
 
Flutter single codebase to build your dream application for i os and android
Flutter single codebase to build your dream application for i os and android Flutter single codebase to build your dream application for i os and android
Flutter single codebase to build your dream application for i os and android Concetto Labs
 
Case study on tablet application for real time video, audio and ppt conversion
Case study on tablet application for real time video, audio and ppt conversionCase study on tablet application for real time video, audio and ppt conversion
Case study on tablet application for real time video, audio and ppt conversionGrey Matter India Technologies PVT LTD
 
Extensibility in application
Extensibility in applicationExtensibility in application
Extensibility in applicationAbhishek Sur
 
SeMA: A Design Methodology for Building Secure Android Apps
SeMA: A Design Methodology for Building Secure Android AppsSeMA: A Design Methodology for Building Secure Android Apps
SeMA: A Design Methodology for Building Secure Android AppsVenkatesh Prasad Ranganath
 
Flutter app development company
Flutter app development companyFlutter app development company
Flutter app development companyMathewBairstow
 

What's hot (20)

Android application project presentation.
Android application project presentation.Android application project presentation.
Android application project presentation.
 
5 beginner android application development foundation
5 beginner android application development foundation5 beginner android application development foundation
5 beginner android application development foundation
 
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash ScreenMobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
 
Android app ppt
Android app pptAndroid app ppt
Android app ppt
 
job job
job jobjob job
job job
 
Android task manager project presentation
Android task manager project presentationAndroid task manager project presentation
Android task manager project presentation
 
Iterative development & rational unified process
Iterative development &  rational unified processIterative development &  rational unified process
Iterative development & rational unified process
 
Android article
Android articleAndroid article
Android article
 
Making Android Easier to Develop
Making Android Easier to DevelopMaking Android Easier to Develop
Making Android Easier to Develop
 
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, TimerMobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
 
Application for Data Sync Between Different geo Locations
Application for Data Sync Between Different geo LocationsApplication for Data Sync Between Different geo Locations
Application for Data Sync Between Different geo Locations
 
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...
Introduction to  Android   Programming by  Dr.M.Pyingkodi-kongu engineering c...Introduction to  Android   Programming by  Dr.M.Pyingkodi-kongu engineering c...
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...
 
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARIMOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARI
 
Difference between system software and application software
Difference between system software and application softwareDifference between system software and application software
Difference between system software and application software
 
Real-time Text Audio to Video PPT Converter Tablet App
Real-time Text Audio to Video PPT Converter Tablet AppReal-time Text Audio to Video PPT Converter Tablet App
Real-time Text Audio to Video PPT Converter Tablet App
 
Flutter single codebase to build your dream application for i os and android
Flutter single codebase to build your dream application for i os and android Flutter single codebase to build your dream application for i os and android
Flutter single codebase to build your dream application for i os and android
 
Case study on tablet application for real time video, audio and ppt conversion
Case study on tablet application for real time video, audio and ppt conversionCase study on tablet application for real time video, audio and ppt conversion
Case study on tablet application for real time video, audio and ppt conversion
 
Extensibility in application
Extensibility in applicationExtensibility in application
Extensibility in application
 
SeMA: A Design Methodology for Building Secure Android Apps
SeMA: A Design Methodology for Building Secure Android AppsSeMA: A Design Methodology for Building Secure Android Apps
SeMA: A Design Methodology for Building Secure Android Apps
 
Flutter app development company
Flutter app development companyFlutter app development company
Flutter app development company
 

Similar to MobileAppDev Handout#4

Android Connecting to internet Part 2
Android  Connecting to internet Part 2Android  Connecting to internet Part 2
Android Connecting to internet Part 2Paramvir Singh
 
Android - Background operation
Android - Background operationAndroid - Background operation
Android - Background operationMatteo Bonifazi
 
[Android] Multiple Background Threads
[Android] Multiple Background Threads[Android] Multiple Background Threads
[Android] Multiple Background ThreadsNikmesoft Ltd
 
djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...
djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...
djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...Dr. Thippeswamy S.
 
Asynchronous Programming in Android
Asynchronous Programming in AndroidAsynchronous Programming in Android
Asynchronous Programming in AndroidJohn Pendexter
 
2014_report
2014_report2014_report
2014_reportK SEZER
 
Parallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MPParallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MPIJSRED
 
Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...
Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...
Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...IDES Editor
 
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...DroidConTLV
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3DHIRAJ PRAVIN
 
Final sds of academic a webpage based android application
Final sds of academic a webpage based android applicationFinal sds of academic a webpage based android application
Final sds of academic a webpage based android applicationpreeta sinha
 
Device Drivers
Device DriversDevice Drivers
Device DriversSuhas S R
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering JayaKamal
 
Android Application Development for Intel Platform
Android Application Development for Intel PlatformAndroid Application Development for Intel Platform
Android Application Development for Intel PlatformAtifAliHaral
 

Similar to MobileAppDev Handout#4 (20)

Android Connecting to internet Part 2
Android  Connecting to internet Part 2Android  Connecting to internet Part 2
Android Connecting to internet Part 2
 
Android - Background operation
Android - Background operationAndroid - Background operation
Android - Background operation
 
Task programming
Task programmingTask programming
Task programming
 
Background Thread
Background ThreadBackground Thread
Background Thread
 
[Android] Multiple Background Threads
[Android] Multiple Background Threads[Android] Multiple Background Threads
[Android] Multiple Background Threads
 
djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...
djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...
djypllh5r1gjbaekxgwv-signature-cc6692615bbc55079760b9b0c6636bc58ec509cd0446cb...
 
Asynchronous Programming in Android
Asynchronous Programming in AndroidAsynchronous Programming in Android
Asynchronous Programming in Android
 
2014_report
2014_report2014_report
2014_report
 
Aneka
AnekaAneka
Aneka
 
Parallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MPParallelization of Graceful Labeling Using Open MP
Parallelization of Graceful Labeling Using Open MP
 
Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...
Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...
Analysis of 3-D Model in ANSYS 9.0 by Java Program and Macros Using Interlink...
 
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3
 
GCF
GCFGCF
GCF
 
Final sds of academic a webpage based android application
Final sds of academic a webpage based android applicationFinal sds of academic a webpage based android application
Final sds of academic a webpage based android application
 
Uma SunilKumar Resume
Uma SunilKumar ResumeUma SunilKumar Resume
Uma SunilKumar Resume
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering
 
Android Application Development for Intel Platform
Android Application Development for Intel PlatformAndroid Application Development for Intel Platform
Android Application Development for Intel Platform
 
p850-ries
p850-riesp850-ries
p850-ries
 

More from trupti1976

More from trupti1976 (11)

MobileAppDev Handout#2
MobileAppDev Handout#2MobileAppDev Handout#2
MobileAppDev Handout#2
 
CP Handout#10
CP Handout#10CP Handout#10
CP Handout#10
 
CP Handout#9
CP Handout#9CP Handout#9
CP Handout#9
 
CP Handout#8
CP Handout#8CP Handout#8
CP Handout#8
 
CP Handout#7
CP Handout#7CP Handout#7
CP Handout#7
 
CP Handout#6
CP Handout#6CP Handout#6
CP Handout#6
 
CP Handout#5
CP Handout#5CP Handout#5
CP Handout#5
 
CP Handout#4
CP Handout#4CP Handout#4
CP Handout#4
 
CP Handout#3
CP Handout#3CP Handout#3
CP Handout#3
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
CP Handout#1
CP Handout#1CP Handout#1
CP Handout#1
 

Recently uploaded

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 

MobileAppDev Handout#4

  • 1. Mobile Application Development T. S. Indi, IT Department, WIT Solapur Page 1 Hadnout#4 Problem Statement: Design and implement Calculator (Arithmetic Operations) App using AsyncTask concept. Theory: Use of AsyncTask: Use of AsyncTask is to run tasks, which consists computationally intensive operations, asynchronously from the UI threads. Need of AsyncTask: Implementing multithreading if multiple threads are involved in updating the UI is more tedious. This can be done with simple mechanism provided in Android is called AsyncTask. AsyncTask (Asynchronous Task)  It enables proper and easy use of the UI thread.  It allow to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.  It is designed to be a helper class around Thread and Handler and does not constitute a generic threading framework.  It should ideally be used for short operations (a few seconds at the most.)  It is defined by a computation that runs on a background thread and whose result is published on the UI thread.  It is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute.
  • 2. Mobile Application Development T. S. Indi, IT Department, WIT Solapur Page 2 AsyncTask deals with two key aspects: (1) Execute the long-running task in the background (in a separate thread) Callback method: doInBackground(Params params..) (2) Update the main thread as the task progresses or completes. Callback method: onProgressUpdate(Progress… progress) To meet above key aspects, AsyncTask class provides two key callback methods: (1) doInBackground(Params params…) Gets executed on a separate thread in the background, different from main thread. is an ideal place for long-running tasks (2) onProgressUpdate(Progress… progress) Gets executed on the main thread is suited to update the progress of the background task on UI. (3) publishProgress(params) Gets executed inside doInBackground(Params params…) method. Helps to establish asynochronous communication between the doInBackground () and onProgressUpdate() An AsyncTask is implemented as a nested class of an Activity whose UI it needs to Update. [Reference: Book -“Mobile Apps Development” by Anubhav Pradhan, Anil V Deshpande]
  • 3. Mobile Application Development T. S. Indi, IT Department, WIT Solapur Page 3 Design: Steps: 1) Design an app to perform Arithmetic Operations such as Addition, Subtraction and Multiplication for integer numbers. 2) Design layout with two TextView, two EditText, three TextView to display results and “Submit” button. 3) User enters two numbers and click on “Submit” button. 4) On click of “Submit” button, two numbers passed to Asynchronous Task thread to perform Addition, Subtraction and Multiplication of two numbers. 5) Results performed in AsyncTask will be updated on main layout. Questions: 1) What is asynTask in Android? 2) Illustrate the benefits of AsyncTask over Threads for implementing long-running tasks. 3) Difference between AsyncTask & Handler in Android. 4) Explain concept of Handler & Looper in Android. 5) Explain event-handling paradigm with the help of example.