0

我正在创建一个应用程序,当我按下按钮时将 TextView 内容发送到我的电子邮件,但我知道如何执行此操作,我需要帮助。

我需要发送到电子邮件 tvFechaSi 和 ImageView 到 wrfrewf@gmail.com(是假电子邮件)

public class FormBotonSi extends Activity {

      private String SFecha; 
      private TextView tvFechaSi ;    
      private static final int CAMERA_REQUEST = 1888; 
      private ImageView imageView;


    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.formbotonsi);

        Bundle bundle=getIntent().getExtras();


        tvFechaSi=(TextView) findViewById(R.id.tvFechaSi);
        Fecha =bundle.getString("Fecha");
        tvFechaSi.setText(Fecha.toString()); 

        this.imageView = (ImageView)this.findViewById(R.id.imageView1);
        Button photoButton = (Button) this.findViewById(R.id.button1);


        Spinner sp = (Spinner) findViewById(R.id.spinner1);
        ArrayAdapter adapter = ArrayAdapter.createFromResource(
            this, R.array.tipoPrioridad, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        sp.setAdapter(adapter);   




        photoButton.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
                startActivityForResult(cameraIntent, CAMERA_REQUEST); 
            }
        });
    }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
        if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {  
            Bitmap photo = (Bitmap) data.getExtras().get("data"); 
            imageView.setImageBitmap(photo);
        }  
    } 

}
4

2 回答 2

2

我认为这段代码可以帮助你:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"youremail@gmail.com"});  
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Email Subject");
sendIntent.putExtra(Intent.EXTRA_STREAM,tvFechaSi.getText());
sendIntent.setType("text/html");
startActivity(sendIntent);
于 2012-11-15T14:48:50.793 回答
0

您可以使用ACTION_SEND意图操作:

Intent i = new Intent(Intent.ACTION_SEND);  
i.putExtra(Intent.EXTRA_EMAIL, new String[]{"wrfrewf@gmail.com"});  
i.putExtra(Intent.EXTRA_SUBJECT,"subject goes here");  
i.putExtra(Intent.EXTRA_TEXT, tvFechaSi.getText());  
startActivity(Intent.createChooser(i, "Select email application."));
于 2012-11-15T14:49:16.167 回答