随笔分类 - Android 进程线程
摘要:1.Thread.UncaughtExceptionHandler java里有很多异常如:空指针异常,越界异常,数值转换异常,除0异常,数据库异常等等。如果自己没有try / catch 那么线程就崩溃。 并不能对所有代码都try/catch,如果代码产生了未捕获的异常,又不想让程序崩溃,或者在崩
阅读全文
摘要:1.简介 在Android 5.0 提供了一套新的 JobScheduler API,它允许您定义要在以后的某个时间或在指定的条件下(例如,当设备在充电时)异步运行的作业来优化电池寿命。 https://developer.android.com/reference/android/app/job/
阅读全文
摘要:1.AsyncTask是串行的 在android 1.6之前 2.同时最多只能执行5个 android 1.6~2.3:改成了并行的. 从1.6开始,AsyncTask引入了线程池,支持同时执行5个异步任务,也就是说同时只能有5个线程运行,超过的线程只能等待,等待前面的线程某个执行完了才被调度和运行
阅读全文
摘要:Hanlder + 弱引用防内存漏泄示例:
阅读全文
摘要:1.快速复习 1.1 基本装置 每个想通信的线程都要安装上述装置,主线程默认已经安装。 1.2 基本工作流程 Looper.prepare(); Looper.loop(); ... Hanlder.sendMessage(xxx); Hanlder.handleMessage(xxx); Loop
阅读全文
摘要:Communicating with the UI Thread 上一课 下一课 Communicating with the UI Thread 上一课 下一课 1.This lesson teaches you to Define a Handler on the UI Thread Move
阅读全文
摘要:Running Code on a Thread Pool Thread 上一课 下一课 Running Code on a Thread Pool Thread 上一课 下一课 1.This lesson teaches you to Run a Runnable on a Thread in t
阅读全文
摘要:Creating a Manager for Multiple Threads 上一课 下一课 Creating a Manager for Multiple Threads 上一课 下一课 1.This lesson teaches you to Define the Thread Pool Cl
阅读全文
摘要:Specifying the Code to Run on a Thread 上一课 下一课 Specifying the Code to Run on a Thread 上一课 下一课 1.This lesson teaches you to Define a Class that Impleme
阅读全文
摘要:Sending Operations to Multiple Threads Sending Operations to Multiple Threads 1.Dependencies and prerequisites Android 3.0 (API Level 11) or higher Lo
阅读全文