Call camera, VCR

Source: Internet
Author: User

<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:paddingbottom= "@dimen/activity_vertical_margin"Android:paddingleft= "@dimen/activity_horizontal_margin"Android:paddingright= "@dimen/activity_horizontal_margin"Android:paddingtop= "@dimen/activity_vertical_margin"Tools:context= "Com.example.lenovo.service.XiangjiActivity"android:orientation= "vertical">    <ButtonAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:onclick= "Bt_1"Android:text= "Camera"/>    <ButtonAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:onclick= "Bt_2"Android:text= "VCR"/></LinearLayout>
Activity

Package Com.example.lenovo.service;import Android.content.intent;import Android.net.uri;import Android.os.environment;import Android.provider.mediastore;import Android.support.v7.app.appcompatactivity;import Android.os.bundle;import Android.view.view;import Java.io.file;public class Xiangjiactivity extends appcompatactivity {@Override protected void onCreate (Bundle savedinstancestate) {super.oncreate (Savedinstan        Cestate);    Setcontentview (R.layout.activity_xiangji);        } public void Bt_1 (View v) {Intent intent=new Intent ();        Intent.setaction ("Android.media.action.IMAGE_CAPTURE");        Intent.addcategory ("Android.intent.category.DEFAULT");        File File=new file (environment.getexternalstoragedirectory () + "/000.jpg");        Uri uri=uri.fromfile (file);        Intent.putextra (Mediastore.extra_output,uri);    This.startactivity (Intent);        } public void Bt_2 (View v) {Intent intent=new Intent (); Intent.setaction ("Android.meDia.action.VIDEO_CAPTURE ");        Intent.addcategory ("Android.intent.category.DEFAULT");        File File=new file (environment.getexternalstoragedirectory () + "/000.3gp");        Uri uri=uri.fromfile (file);        Intent.putextra (Mediastore.extra_output,uri);    This.startactivity (Intent); }}
Java

Call camera, VCR

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.