You create a method in an Activity to start another Activity called PhotoActivity and get a result back using an explicit Intent. Code is designed to clearly define code requirements and enhance code clarity to be well-structured, maintainable, and easy to understand. Which of the following is correct?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Để tạo một phương thức trong một Activity để bắt đầu một Activity khác gọi là PhotoActivity và nhận lại kết quả sử dụng một Intent rõ ràng, chúng ta cần sử dụng phương thức startActivityForResult(). Phương thức này yêu cầu hai tham số: Intent và mã yêu cầu. Trong trường hợp này, chúng ta đã tạo một Intent mới để bắt đầu PhotoActivity và sử dụng mã yêu cầu PHOTO_REQUEST. Mã yêu cầu này được sử dụng để nhận lại kết quả từ PhotoActivity. Vì vậy, câu trả lời đúng là: Intent intent = new Intent(this, PhotoActivity.class); startActivityForResult(intent, PHOTO_REQUEST);
Cùng chương 2
How do you send data from an activity to a fragment?Có lời giảiCâu hỏiFragmentManager is the class responsible for performing actions on your app's fragments, such as adding, removing, or replacing them, and adding them to the back stack.Có lời giảiCâu hỏiWhich of the following statements accurately reflect what happens when a user enters text via the Android virtual keyboard?Có lời giảiCâu hỏiCả 27 câu của chủ đề27 câu
Đi tiếp từ đây