SỬ DỤNG CHO CAMERA ÐIỂM HÌNH ẢNH
G1 T-Mobile đã được phát hành vào năm 2008 với một camera 3.2-megapixel. Ngày nay, hầu hết các thiết bị tính năng ít nhất một camera 5-megapixel, với một số mô hình thể thao camera 8.1-megapixel. Các mặt khắp nơi của điện thoại thông minh có tính năng ngày càng máy ảnh chất lượng cao đã làm cho các ứng dụng máy ảnh bổ sung phổ biến cho Google Play.
Các phần sau đây chứng tỏ các cơ chế, bạn có thể sử dụng để điều khiển máy ảnh và chụp ảnh trong các ứng dụng của bạn.
Sử dụng Intents để Take Hình
Cách dễ nhất để có một bức tranh từ bên trong ứng dụng của bạn là để bắn một Intent sử dụng hành MediaStore.ACTION_IMAGE_CAPTURE:
startActivityForResult (
Ý định mới (MediaStore.ACTION_IMAGE_CAPTURE), TAKE_PICTURE);
này sẽ khởi chạy một ứng dụng máy ảnh để chụp ảnh, cung cấp người dùng với các bộ đầy đủ của máy ảnh chức năng mà không cần phải viết lại các ứng dụng máy ảnh bản địa.
một khi người dùng hài lòng với hình ảnh, kết quả được trả về cho ứng dụng của bạn trong các ý định nhận được xử lý onActivityResult.
theo mặc định, các bức ảnh chụp sẽ được trả lại như một hình ảnh thu nhỏ, có sẵn như là một bitmap liệu trong thêm dữ liệu trong Ý định trở lại.
để có được một hình ảnh đầy đủ, bạn phải chỉ định một tập tin mục tiêu, trong đó để lưu trữ nó, được mã hóa như là một URI thông qua việc sử dụng các MediaStore.EXTRA_0UTPUT phụ trong Ý định ra mắt, như thể hiện trong Bảng liệt 15-23.
đang được dịch, vui lòng đợi..