Android осень 2013 лекция 3

Click here to load reader

  • date post

    15-Jun-2015
  • Category

    Education

  • view

    333
  • download

    2

Embed Size (px)

Transcript of Android осень 2013 лекция 3

  • 1. 3 Android Multithreading

2. ? ? ? ( )? commit()? RelativeLayout LinearLayout? StateListDrawable? xml drawable? 2 3. Java Thread Runnable Callable Executors Join, sleep, wait, notify 3 4. Android UI Thread CalledFromWrongThreadEx ception Loopers & Handlers Activity.runOnUiThread() AsyncTasks IntentService4 5. Looper MessageQueue Handler ThreadLocal java.lang.RuntimeExcepti on: Can't create handler inside thread that has not called Looper.prepare()5 6. Looper Life Cycle6 7. Looper Life Cycle7 8. Looper Life Cycle8 9. Looper create9 10. Handler Runnables Looper , 10 11. AsyncTask11 12. AsyncTask background UI thread Thread, Looper, Handler . : doInBackground(Params p){return Result onProgressUpdate(Progress pr) onPostExecute(Result) new AsyncTaskExample().execute(Params) 12 13. AsyncTask AsyncTask cancel doInBackground onPostExecute onCancelled AsyncTasks ( Honeycomb), executeOnExecutor() get() Result 13 14. Processes I foreground process , activity, , startForeground() life cycle callbacksActivity, , onReceive()II visible process Activity onPause() III service process IV Background process , startService() activity, V Empty process 14 15. Processes Android : .. background activity, , 15