TAILIEUCHUNG - Lập trình Androi part 24

Như bạn đã biết, các thiết bị Android, và lớn, có điện thoại. Như vậy, một số hoạt động quan trọng hơn mà những người khác, tham gia một cuộc gọi có lẽ là quan trọng hơn cho người dùng hơn so với chơi Sudoku. Và, vì nó là một điện thoại, nó có thể có RAM ít hơn máy tính để bàn máy tính xách tay hiện tại hoặc của bạn sở hữu. | Chapter Handling Activity Life Cycle Events As you know Android devices by and large are phones. As such some activities are more important that others taking a call is probably more important to users than playing Sudoku. And since it is a phone it probably has less RAM than your current desktop or notebook possesses. As a result of the device s limited RAM your activity may find itself being killed off because other activities are going on and the system needs your activity s memory. Think of it as the Android equivalent of the circle of life Your activity dies so others may live and so on. You cannot assume that your activity will run until you think it is complete or even until the user thinks it is complete. This is one example perhaps the most important example of how an activity s life cycle will affect your own application logic. This chapter covers the various states and callbacks that make up an activity s life cycle and how you can hook into them appropriately. Schroedinger s Activity An activity generally speaking is in one of four states at any point in time Active The activity was started by the user is running and is in the foreground. This is what you re used to thinking of in terms of your activity s operation. Paused The activity was started by the user is running and is visible but a notification or something is overlaying part of the screen. During this time the user can see your activity but may not be able to interact with it. For example if a call comes in the user will get the opportunity to take the call or ignore it. 167 CHAPTER 16 Handling Activity Life Cycle Events Stopped The activity was started by the user is running but is hidden by other activities that have been launched or switched to. Your application will not be able to present anything meaningful to the user directly but may communicate by way of a notification discussed in Chapter 31 . Dead Either the activity was never started . just after a phone reset or the activity was

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.