TAILIEUCHUNG - Beginning Android PHẦN 2

hoặc bằng bất kỳ lưu trữ thông tin hoặc hệ thống thu hồi, mà không có sự cho phép trước bằng văn bản của chủ sở hữu quyền tác giả và nhà xuất bản. bên đó hoặc nếu không đảm bảo của nội dung của bạn không được cắt bớt trong thời trang mà. | 16 CHAPTER 4 CREATING A SKELETON APPLICATION in src com commonsware android . Inside the innermost directory you should find a pregenerated source file named which is where your first activity will go. This activity will contain a single button that displays the time the button was last pushed or the time the application was started if the button hasn t been pushed . Open in your editor and paste in the following code package import import import import import public class Now extends Activity implements Button btn @Override public void onCreate Bundle icicle icicle btn new Button this this updateTime setContentView btn public void onClick View view updateTime private void updateTime new Date .toString Or if you download the source files off the CommonsWare Web site you can just use the Skeleton Now project directly. Let s examine this piece-by-piece. Dissecting the Activity The package declaration needs to be the same as the one you used when creating the project. And like in any other Java project you need to import any classes you reference. Most of the Android-specific classes are in the android package CHAPTER 4 CREATING A SKELETON APPLICATION 17 package import import import import import It s worth noting that not every Java SE class is available to Android programs. Visit the Android class reference2 to see what is and is not available. Activities are public classes inheriting from the base class. In this case the activity holds a button btn public class Now extends Activity implements Button btn Note A button as you can see from the package name is an Android widget and widgets .

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.