我可以知道如何在一个活动中运行两个功能 例子c-> b-> a
camera.takePicture(null, null, null, jpegCallBack);
public void sendemail(){
public void performDial(){
这个所有功能都在一个活动中
请帮助我谢谢
答案 0 :(得分:3)
打开相机并使用此
拍照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..."));
}