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(savedInstanceState);
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);
}
}