この記事では、Android自体を使用してレターを送信する方法と、さらに興味深い方法を示しますが、プログラマーが受け入れやすい方法でレターを送信できる外部ライブラリを使用します。
パート1.メール、メールのみ
これを行う方法:通常、追加のアクティビティがプログラムに組み込まれます。これは、To、Subject、およびTextのいくつかのフィールドを持つウィンドウです。 さらに、これらのフィールドのデータは追加コンテンツとして送信されます。
- android.content.Intent.EXTRA_EMAIL
- android.content.Intent.EXTRA_SUBJECT
- android.content.Intent.EXTRA_TEXT
SimpleEMail.javaファイルのコード自体
さて、コードはいシンプルです。 真実はさらに単純です。フィールドに入るための追加アクティビティを作成するのが面倒なら、インテントを起動するだけで済みます。public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
public class SimpleEMail extends Activity { Button send; EditText address, subject, emailtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_email); // send = (Button) findViewById(R.id.emailsendbutton); address = (EditText) findViewById(R.id.emailaddress); subject = (EditText) findViewById(R.id.emailsubject); emailtext = (EditText) findViewById(R.id.emailtext); send.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType( "plain/text" ); // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] { address.getText().toString() }); // emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString()); // emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString()); // emailIntent.putExtra( android.content.Intent.EXTRA_STREAM, Uri .parse( "file://" + Environment.getExternalStorageDirectory() + "//SOTY_ATHD.mp4" )); emailIntent.setType( "text/video" ); // ! SimpleEMail. this .startActivity(Intent.createChooser(emailIntent, " ..." )); } }); } } * This source code was highlighted with Source Code Highlighter .
長所:簡単な実装で、フィードバックに十分便利です。
短所:ユーザーは、メールメッセージを送受信するためのプログラムを設定する必要があります。これがないと、このインテントを処理する人はいません。
パート2.メール、匿名メール
プロジェクトでこの方法を使用しました。まず利点の概要を説明します。
- ユーザーからカスタマイズされたクライアントを必要としません
- 完全に匿名である場合があります
- すべてを転送することができます(当然、理由の範囲内で)
それらをダウンロードし、プロジェクトに埋め込みます:プロジェクトコンテキストメニュー> "ビルドパス"> "外部アーカイブの追加..."> "追加ファイル、メール、アクティベーション"
構成するには、gmail.comに登録されたメールボックス(またはその他のyandex、メールなど)の設定も必要です( ここで確認できます)。 この場合、それは私たちの手紙が通過するゲートウェイとして機能します。
設定を開始します。
MailSenderClass.java
このクラスでは、メッセージが送信されるサーバーの設定が記録されます。 ここにいくつかの方法があります:
- public MailSenderClass(文字列ユーザー、文字列パスワード)-コンストラクター。 gmail.comの中間メールボックスからのユーザー名とパスワードが引数として渡されます。 サーバーへのsmtp-connectionのパラメーターもここに登録されます。
- protected PasswordAuthentication getPasswordAuthentication()-サーバーの認証。
- public synchronized void sendMail(文字列の件名、文字列の本文、文字列の送信者、文字列の受信者、文字列のファイル名)-送信のためにデータが送信されるメインメソッド。
最後のメソッドのコードをもう少し詳しく見てみましょう。
この方法も簡単です。 MimeMessageクラスのオブジェクトを使用して、レターを作成し、送信用にTransportメソッドであるsendメソッドに渡します。
*このソースコードは、 ソースコードハイライターで強調表示されました。
- public synchronized void sendMail( 文字列の件名、 文字列の本体、 文字列の送信者、 文字列の受信者、 文字列のファイル名)が例外をスローします{
- {
- MimeMessageメッセージ= 新しい MimeMessage(セッション);
- //誰
- message.setSender( 新しい InternetAddress(送信者));
- //どうですか
- message.setSubject(サブジェクト);
- //に
- if (recipients.indexOf( '、' )> 0)
- message.setRecipients(Message.RecipientType.TO、
- InternetAddress.parse(recipients));
- 他に
- message.setRecipient(Message.RecipientType.TO、
- 新しい InternetAddress(受信者));
- //言いたい
- BodyPart messageBodyPart = new MimeBodyPart();
- messageBodyPart.setText(body);
- _multipart.addBodyPart(messageBodyPart);
- //そして何を表示するか
- if (!filename.equalsIgnoreCase( "" )){
- BodyPart attachBodyPart = new MimeBodyPart();
- DataSource source = new FileDataSource(ファイル名);
- attachBodyPart.setDataHandler( 新しい DataHandler(ソース));
- attachBodyPart.setFileName(ファイル名);
- _multipart.addBodyPart(attachBodyPart);
- }
- message.setContent(_multipart);
- Transport.send(メッセージ);
- } catch (例外e){
- Log.e( "sendMail" 、 "関数sendmail!の送信エラー!" );
- }
- }
JSSEProvider.java
メールのセキュリティプロトコルプロバイダー。 リンク
VideoSelect.java
コードは、Android SDKにバンドルされているApiDemosから取得したもので、startActivityForResultメソッドを使用して実行するために微調整されました。
実行後、メモリカード上のファイルへのパスを含む文字列が返されます。 このコードはプロジェクトで見ることができ、記事の最後にあります。
ExtendedMail.java
メッセージを送信するための主な方法は、AsyncTaskクラスを表すsitv_sender_mail_async関数で実行されます。
すべてがシンプルで、MailSenderClassクラスのインスタンスを作成し、ユーザー名とパスワードをコンストラクターに渡します。 次に、パラメーターを指定してsendmail sendメソッドを呼び出します。
*このソースコードは、 ソースコードハイライターで強調表示されました。
- private class sender_mail_async extends AsyncTask <Object、 String 、Boolean> {
- ProgressDialog WaitingDialog;
- @Override
- protected void onPreExecute(){
- //ユーザーの起動プロセスを表示します
- WaitingDialog = ProgressDialog.show(ExtendedMail。This、 "Sending data" 、 "Sending a message ..." 、 true );
- }
- @Override
- protected void onPostExecute(ブール結果){
- //起動プロセスを非表示にします
- WaitingDialog.dismiss();
- Toast.makeText(mainContext、 「 Submission completed !!!」 、Toast.LENGTH_LONG).show();
- ((アクティビティ)mainContext).finish();
- }
- @Override
- protected Boolean doInBackground(Object ... params ){
- {
- //フィールドからデータを取得します
- title =((EditText)findViewById(R.id.screen_sendnews_et_title))。getText()。toString();
- text =((EditText)findViewById(R.id.screen_sendnews_et_text))。getText()。toString();
- from = "from_post_msg@gmail.com" ;
- where = "where_post_msg@yandex.ru" ;
- //コンストラクタを呼び出して、メールボックスからgmail.comにユーザー名とパスワードを渡します
- MailSenderClass sender = new MailSenderClass( "mypostmail@gmail.com" 、 "password" );
- //そしてsendメソッドを呼び出します
- sender.sendMail(タイトル、テキスト、 from 、 where 、attach);
- } catch (例外e){
- Toast.makeText(mainContext、 "メッセージ送信エラー!" 、Toast.LENGTH_SHORT).show();
- }
- falseを 返し ます 。
- }
- }
非同期プロセスは、onPreExecute()、doInBackground()、およびonPostExecute()の3つのメソッドで構成され、これらは記述された順序で実行されます。
それを使用する方法を忘れた人のために、ここにコードがあります:
*このソースコードは、 ソースコードハイライターで強調表示されました。
- public void onClick(View v){
- sender_mail_async async_sending = new sender_mail_async();
- async_sending.execute();
- }
したがって、小さなストリームクラスを作成すると、クライアントからメールボックスに必要な情報を安全に送信できます。
アプリケーションのソースコードは、 ここからダウンロードできます 。