• 8
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

What class does Android use to simplify background thread creation and UI thread synchronization?

AsyncTask is the class you are looking for.

You can find more information about it within the official Android Documentations.

  • 61
Reply Report
    • For this to be a valuable answer, you will need to expand on why AsyncTask is useful in solving OP's problem.
    • Well, since we now know the class name can't someone simply go to the Android docs and get that info? Make sure you flame Kshitij as well for not providing an essay on why AsyncTask is useful. You want to be fair right?

AsyncTask

AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.

AsyncTask is designed to be a helper class around Thread and Handler and does not constitute a generic threading framework. AsyncTasks should ideally be used for short operations (a few seconds at the most.)

  • 19
Reply Report
  1. AsyncTask is the class when you have some simple tasks to run in background. But it is not good is there are too many tasks.
  2. Service is the component that android provided for the developer to use to do background task. And you could use binder or Messenger to communicate with Activity or UI thread.
  3. And you Surly could create new thread from your Activity or Application. It depends on your demand or situation.
  • 7
Reply Report