介紹Android拍照,錄影開發的相關東東

來源:互聯網
上載者:User

標籤:android   io   ar   檔案   art   cti   on   new   c   

Android下相機有內建的照片功能,可是作為開發人員,我們需要更為深層次的知道,怎麼用,以及相關原理,這裡我就這方面的學習,寫一下心得,供博友參考。

第一種:調用系統內建相機介面。
這時我們在布局檔案中,只簡單的定義一個按鈕就可以了。
<Button
android:onClick="click"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="拍照" />

在activity中,我們這樣實現就好了。

public void click(View view){
Intent intent = new Intent();
intent.setAction("android.media.action.IMAGE_CAPTURE");
intent.addCategory("android.intent.category.DEFAULT");
File file = new File("/sdcard/apple/"+System.currentTimeMillis()+".jpg");
Uri uri = Uri.fromFile(file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);

startActivity(intent);
}
這時最為簡單的方式,我們就可以把熊他那個的洗那估計進行調用了。

介紹Android拍照,錄影開發的相關東東

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.