2013-05-31 80 views

回答

1
findViewById(R.id.imageview).setOnClickListener(new OnClickListener() { 
    public void onClick(View _) { 
     Intent i = new Intent(Intent.ACTION_VIEW); 
     i.setData(Uri.fromParts("mailto","[email protected]", null)); 
     startActivity(i); 
    } 
} 
1
img.setOnClickListener(
    new OnClickListener(View v) { 
     String yourMail = "[email protected]"; 
     Intent intent = new Intent(Intent.ACTION_SEND); 
     intent.setType("message/rfc822"); 
     intent.putExtra(Intent.EXTRA_EMAIL, new String[]{yourMail}); 
     intent.putExtra(Intent.EXTRA_SUBJECT, "Your subject"); 
     intent.putExtra(Intent.EXTRA_TEXT, "Your content"); 
     try { 
      startActivity(intent, "Pick an email application..."); 
     } catch(Exception e) { 
      Toast.makeText(YourMainActivity.this, "Have no email application!", Toast.LENGTH_SHORT).show(); 
     } 
    } 
); 
+0

谢谢你,我的作品。 – user2438683