package gr.mybook.myemail;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {
	EditText eText1, eText2, eText3;
	Button btn;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		eText1 = (EditText) findViewById(R.id.editText1);
		eText2 = (EditText) findViewById(R.id.editText2);
		eText3 = (EditText) findViewById(R.id.editText3);
		btn = (Button) findViewById(R.id.button1);
	}
	
	public void sendEmail(View v) {
		  String to = eText1.getText().toString();
		  String subject = eText2.getText().toString();
		  String message = eText3.getText().toString();

		  Intent emailIntent = new Intent(Intent.ACTION_SEND);
		  emailIntent.putExtra(Intent.EXTRA_EMAIL, to);
		  emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
		  emailIntent.putExtra(Intent.EXTRA_TEXT, message);
		  emailIntent.setType("message/rfc822");
		  startActivity(Intent.createChooser(emailIntent, "Choose an Email client :"));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
