MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology


MultiThread in Android
Previous Home Next

A Thread is a concurrent unit of execution. Thread is the light weight .The "Main." Thread is created when the execution for the application started. typically, there are several others for housekeeping. Multiple threads can exist within the same process and share memory resources. Execution of thread is fast compare to process.

Threads in the same Virtual Machine interact and synchronize by the use of shared objects and monitors associated with these objects. Synchronized methods and part of the API in Object also allow Threads to cooperate.

There are 2 way used the thread

  1. Create the own class that extends Thread and overriding run() method.
  2. The second think is implementation the Runnable interface.

dvantage of Multi Thread in Android


  1. Threads are execute independently, so speed of thread execution is fast compare to process.
  2. Threading provides an useful abstraction of concurrent execution.
  3. Multithreaded program utilizes more CPU resources and operates faster on computer systems that have multiple CPUs.

Interaction between Android threads is accomplished using Handler objects and posting Runnable objects to the main view.

Handler is used when secondary thread that wants to communicate with the main thread .It must request a message token using the obtainMessage() method.

The handleMessage() method is used to handle messages that arriving to the main thread.

There are two main uses for a Handler :

  1. Handler is used to schedule messages and runnables to be executed as some point in the future
  2. Handler is used to enqueue an action to be performed on another thread.

The post() method is helpful for A message extracted from the processí queue.

Previous Home Next