TAILIEUCHUNG - Bài giảng Lập trình cho thiết bị di động: Chương 4 - Trần Duy Thanh

Bài giảng Lập trình cho thiết bị di động: Chương 4 trình bày các nội dung sau: Multi - Threading, Intent filter, Broadcast Receiver, Android Services, Webservice .Net,.! | 1 5. Webservice .Net 4. Android Services 3. Broadcast Receiver 2. Intent filter 1. Multi - Threading 1 2 1. Multi - Threading Introduction Handler class AsyncTask class 2 3 Introduction Threads Android’s threads run in a manner similar to common Java threads A Thread is a concurrent unit of execution. not executing in order has its own call stack for methods being invoked, their arguments and local variables. Each virtual machine instance has at least one main Thread running when it is started; The application might decide to launch additional Threads for specific purposes. 3 4 Introduction Multi- Threading 4 5 Introduction Multi- Threading Threads in the same VM interact and synchronize by the use of shared objects and monitors associated with these objects. There are basically two main ways of having a Thread execute application code. a new class that extends Thread and override its run() method. a new Thread instance passing to it a Runnable object. In both cases, the start() method must be called to actually execute the new Thread. 5 6 Introduction Advantages of Multi- Threading Threads share the process' resources but are able to execute independently. Applications responsibilities can be separated main thread runs UI, and slow tasks are sent to background threads. Threading provides an useful abstraction of concurrent execution. Particularly useful in the case of a single process that spawns multiple threads on top of a multiprocessor system. In this case real parallelism is achieved. Consequently, a multithreaded program operates faster on computer systems that have multiple CPUs. 6 7 Introduction Disadvantages of Multi- Threading Code :more complex Need to detect, avoid, resolve deadlocks Threads not executing in order Runnable Thread? What different? Deadlock and Atomic type 7 8 Handler class An application may involve a time-consuming operation, however we want the UI to

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.