TAILIEUCHUNG - Lập trình Androi part 26

Như các bạn đã học, lý thuyết đằng sau kiến trúc Android UI là nhà phát triển ứng dụng của họ nên bị phân hủy thành các hoạt động khác biệt Mỗi hoạt động được thực hiện như một hoạt động, và mỗi có thể truy cập thông qua intents, với một hoạt động "chính" là một trong những động do Android phóng. Ví dụ, một ứng dụng lịch có thể có các hoạt động để xem lịch, xem một sự kiện đơn lẻ, chỉnh sửa một sự kiện (bao gồm cả việc thêm một hình mới). | Chapter Launching Activities and Subactivities As you ve learned the theory behind the Android UI architecture is that developers should decompose their application into distinct activities Each activity is implemented as an Activity and each is reachable via intents with a main activity being the one launched by the Android launcher. For example a calendar application could have activities for viewing the calendar viewing a single event editing an event including adding a new one and so forth. This implies that one of your activities has the means to start up another activity. For example if someone selects an event from the view-calendar activity you might want to show the view-event activity for that event. So you need to be able to cause the viewevent activity to launch and show a specific event the one the user chose . This chapter describes how to do that. NOTE This chapter assumes that you know which activity you want to launch probably because it is another activity in your own application. It s also possible that you have a content Uri to do something and you want your users to be able to do something with it but you do not know up front what the options are. This situation requires more advanced handling which I cover in my book The Busy Coders Guide to Advanced Android Development CommonsWare 2009 . Peers and Subs One key question you need to answer when you decide to launch an activity is this Does your activity need to know when the launched activity ends For example suppose you want to spawn an activity to collect authentication information for some web service you are connecting to maybe you need to authenticate with OpenID http in order to use an OAuth service 177 CHAPTER 18 Launching Activities and Subactivities http . In this case your main activity will need to know when the authentication is complete so it can start to use the web service. On the other hand imagine an e-mail application in Android. When the user elects to .

Đã 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.