my code stock.com

Para mandar mails

Snippet options

Download: Download snippet as lay_mailjava.java.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

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



public class lay_mail extends Activity 
{
     @Override
    public void onCreate(Bundle savedInstanceState) 
    {    	
        super.onCreate(savedInstanceState);        
   		setContentView(R.layout.lay_mail);       
   		//levantamos botones
   		final EditText edit_cuerpoMail = (EditText) findVixewById(R.id.edit_cuerpoMail);
   		Button btn_send=(Button)findViewById(R.id.btn_send);
   		btn_send.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) 
			{
				// es necesario un intent que levante la actividad deseada
				Intent itSend = new Intent(android.content.Intent.ACTION_SEND);
				// vamos a enviar texto plano a menos que el checkbox esté marcado
				itSend.setType("plain/text");
				itSend.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ "[email protected]"});
				itSend.putExtra(android.content.Intent.EXTRA_SUBJECT, "Little List - Importante - Bug/Sugerencia desde APP!!!");
				itSend.putExtra(android.content.Intent.EXTRA_TEXT, edit_cuerpoMail.getText());
				startActivity(itSend);
			}
		});
   		
    

	}
}

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.