メール本文に画像を表示できません。そのちょうど点在した小さな箱のように見える。メール本文をメール本文に送信する方法
setContentView(R.layout.mailshare);
send = (Button)findViewById(R.id.button1);
address = (EditText)findViewById(R.id.emailaddress);
//subject = (EditText)findViewById(R.id.emailsubject);
// emailtext = (EditText)findViewById(R.id.emailtext);
Bundle extras = getIntent().getExtras();
if(extras != null) {
String emailtitle = extras.getString(TEXT_DATA);
if(emailtitle != null) {
subject = (EditText)findViewById(R.id.emailsubject);
if(subject != null) {
subject.setText(emailtitle);
}
}
}
Bundle mailmsg = getIntent().getExtras();
if(mailmsg != null) {
String bodytext = mailmsg.getString(BODY_TEXT);
if(bodytext != null) {
emailtext = (EditText)findViewById(R.id.emailtext);
if(subject != null) {
emailtext.setText(bodytext);
}
}
}
send.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
[enter link description here][2]//
// TODO Auto-generated method stub
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ address.getText().toString()});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText());
emailIntent.setType("image/png");
Spanned html =Html.fromHtml("<html><body> <img src='http://www.example.com/logo.png'> </body></html>",
new ImageGetter() {
InputStream s;
public Drawable getDrawable(String url) {
try {
s = (InputStream) (new URL(url)).getContent();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Drawable d = Drawable.createFromStream(s, null);
// Log.debug(this, "Got image: " + d.getClass() + ", " + d.getIntrinsicWidth() + "x" + d.getIntrinsicHeight());
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}},null);
// emailIntent.putExtra(emailIntent.EXTRA_TEXT, html);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, html);
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
});
}
}
こんにちはVikky ...次のコードでやった、しかし、私は、メール本文のテキストの末尾にロゴを追加する必要があります。どのような方法でもあります – user537771
私はvikkyに感謝していますが、上記のコードを使用していますが、表示できませんでした。 – user537771