我可以知道如何在一个活动示例中运行两个功能 c->b->a
camera.takePicture(null, null, null, jpegCallBack);
public void sendemail(){
public void performDial(){
这所有功能都在一个活动中
请帮助我谢谢
我可以知道如何在一个活动示例中运行两个功能 c->b->a
camera.takePicture(null, null, null, jpegCallBack);
public void sendemail(){
public void performDial(){
这所有功能都在一个活动中
请帮助我谢谢
打开你的相机,用这个拍照
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
URI pictureUri = Uri.fromFile(new File(<path where you want to save your file>));
camera.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri);
startActivityForResult(camera);
在那之后onActivityResult
,
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PICTURE_RESULT){
if (resultCode == Activity.RESULT_OK) {
sendEmail(Uri.parse(data.toURI()));
} else if (resultCode == Activity.RESULT_CANCELED) {
}
}
}
private void sendEmail(Uri path){
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/jpeg");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"me@me.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Default Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Default Text");
emailIntent.putExtra(Intent.EXTRA_STREAM, path);
startActivity(Intent.createChooser(emailIntent, "Send email..."));
}