アンドロイドスタジオ:Enviar Correoエレクトリック
17816 ワード
アンドロイドスタジオのアンドロイド
COCO YA Vieron enエルt t Tulo vamos a crear unaペケは、aplicaciを引きます.
主な活動.XML
エヌヌートロ.XML Agregaremos un conjunto de linear layout、donde en cada no no agregaremos undittext、en total agregaremos 3(correo、asunto y mensaje)、tambi en n agregaremos un bot disn、qued ol ndonos el c des dila de sigsigiente manera.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtCorreo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="@string/correo_ejemplo"
android:inputType="textEmailAddress"
android:minHeight="48dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtAsunto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="@string/Asunto"
android:inputType="textPersonName"
tools:ignore="TouchTargetSizeCheck,TouchTargetSizeCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtMensaje"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:lines="10"
android:hint="@string/Mensaje"
android:gravity="start|top"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btnEnviar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/btnEnviar" />
</LinearLayout>
</LinearLayout>
コモse podrええとdar cuenta、ocupamos la propiedadは、en lugarデテキストエヌラスEd TittTextを暗示します.
Nota :ロスEditText息子iguales、ya ocuparemos diferentes para cada campo、como por ejplo :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtCorreo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="@string/correo_ejemplo"
android:inputType="textEmailAddress"
android:minHeight="48dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtAsunto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="@string/Asunto"
android:inputType="textPersonName"
tools:ignore="TouchTargetSizeCheck,TouchTargetSizeCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtMensaje"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:lines="10"
android:hint="@string/Mensaje"
android:gravity="start|top"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btnEnviar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/btnEnviar" />
</LinearLayout>
</LinearLayout>
活動
enエルメインアクティビティcrearemos 3変数tipo edittext y 1 tipoボタン.
Button btnEnviar;
EditText EtCorreo , EtMensaje, EtAsunto;
( En el m ) todo oncreate ()は、EASE変数CON EL Mを使用します. EtCorreo = findViewById(R.id.EtCorreo);
EtAsunto = findViewById(R.id.EtAsunto);
EtMensaje = findViewById(R.id.EtMensaje);
btnEnviar = findViewById(R.id.btnEnviar);
後ろ向きのアグリーレモスについて
btnEnviar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// AQUÍ ESCRIBIREMOS EL CÓDIGO PARA ENVIAR EL CORREO
}
});
Lo Primero que Haremos es Crearemosは、変数Tipoストリングパラシュートで降下します String correo = EtCorreo.getText().toString();
String asunto = EtAsunto.getText().toString();
String mensaje = EtMensaje.getText().toString();
後遺症についての一考察 if(correo.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa un correo", Toast.LENGTH_LONG).show();
}
else if(asunto.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa el asunto", Toast.LENGTH_LONG).show();
}
else if(mensaje.equals(""))
{
Toast.makeText(MainActivity.this, "ingresa un mensaje", Toast.LENGTH_LONG).show();
}
エヌCocoデque Todosロスカンポスエストes n Lenos Loヘイリズes enviarエルCorreo yアルCual Mendiante El Metodo Putextra Le Pasaremos Los par Metros mensaje , asunto y texto y el tipo message/rfc 822 el cual nos permitir des enviar el mensaje
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL,
new String[]{correo});
intent.putExtra(Intent.EXTRA_SUBJECT,asunto);
intent.putExtra(Intent.EXTRA_TEXT, mensaje);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Elije un cliente de correo:"));
第二次大戦中のヘーゼル・アグリーレ・エル・カレッジ・エル・カレッジ・エック・ハ.package com.example.mandarcorreo;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
Button btnEnviar;
EditText EtCorreo , EtMensaje, EtAsunto;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EtCorreo = findViewById(R.id.EtCorreo);
EtAsunto = findViewById(R.id.EtAsunto);
EtMensaje = findViewById(R.id.EtMensaje);
btnEnviar = findViewById(R.id.btnEnviar);
btnEnviar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String correo = EtCorreo.getText().toString();
String asunto = EtAsunto.getText().toString();
String mensaje = EtMensaje.getText().toString();
if(correo.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa un correo", Toast.LENGTH_LONG).show();
}
else if(asunto.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa el asunto", Toast.LENGTH_LONG).show();
}
else if(mensaje.equals(""))
{
Toast.makeText(MainActivity.this, "ingresa un mensaje", Toast.LENGTH_LONG).show();
}
else
{
// Defino mi intent y hago uso del objeto ACTION_SEND
// Intent intent = new Intent(Intent.ACTION_SENDTO);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL,
new String[]{correo});
intent.putExtra(Intent.EXTRA_SUBJECT,asunto);
intent.putExtra(Intent.EXTRA_TEXT, mensaje);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Elije un cliente de correo:"));
}
}
});
}
}
リトルビッグプラネット™2でアップロードsi desean verda click aquí コンEstoヘムターミネータデRealizarトドエルCは、dioエスペックque les sirva y esperen mを得ます.
HASTA LA近親相姦!
エヌヌートロ.XML Agregaremos unconarede de linear layout donde en donda en cno no no agregaremos un edietext,en total agregaremos 3 correo,asunto,mensaje y tambi es n agregar es mos an un bot des n,quedandonos el c c dio de la siguiente manera
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtCorreo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="@string/correo_ejemplo"
android:inputType="textEmailAddress"
android:minHeight="48dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtAsunto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="@string/Asunto"
android:inputType="textPersonName"
tools:ignore="TouchTargetSizeCheck,TouchTargetSizeCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/EtMensaje"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:lines="10"
android:hint="@string/Mensaje"
android:gravity="start|top"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btnEnviar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/btnEnviar" />
</LinearLayout>
</LinearLayout>
コモse podrええとdar cuenta ocupamosは、en Lugarデテキストパラシュートで降下する人que puedan escribir罪borborar灘y queセガンque es es lo que tienen que llenar en cadaカンポです.ロスEditText息子iguales ya ocuparemos diferentes para cada campo como por ejplo :
活動
enエルメインアクティビティcrearemos 3変数tipo edittext y 1 tipoボタン.
Button btnEnviar;
EditText EtCorreo , EtMensaje, EtAsunto;
( En el m ) todo oncreate ()は、EASE変数CON EL Mを使用します. EtCorreo = findViewById(R.id.EtCorreo);
EtAsunto = findViewById(R.id.EtAsunto);
EtMensaje = findViewById(R.id.EtMensaje);
btnEnviar = findViewById(R.id.btnEnviar);
後ろ向きのアグリーレモスについて
btnEnviar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// AQUÍ ESCRIBIREMOS EL CÓDIGO PARA ENVIAR EL CORREO
}
});
Lo Primero que Haremos es Crearemosは、変数Tipoストリングパラシュートで降下します String correo = EtCorreo.getText().toString();
String asunto = EtAsunto.getText().toString();
String mensaje = EtMensaje.getText().toString();
後遺症についての一考察 if(correo.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa un correo", Toast.LENGTH_LONG).show();
}
else if(asunto.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa el asunto", Toast.LENGTH_LONG).show();
}
else if(mensaje.equals(""))
{
Toast.makeText(MainActivity.this, "ingresa un mensaje", Toast.LENGTH_LONG).show();
}
エヌCocoデque Todosロスカンポスエストes n Lenos Loヘイリズes enviarエルCorreo yアルCual Mendiante El Metodo Putextra Le Pasaremos Los par Metros mensaje , asunto y texto y el tipo message/rfc 822 el cual nos permitir des enviar el mensaje
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL,
new String[]{correo});
intent.putExtra(Intent.EXTRA_SUBJECT,asunto);
intent.putExtra(Intent.EXTRA_TEXT, mensaje);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Elije un cliente de correo:"));
第二次大戦中のヘーゼル・アグリーレ・エル・カレッジ・エル・カレッジ・エック・ハ.package com.example.mandarcorreo;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
Button btnEnviar;
EditText EtCorreo , EtMensaje, EtAsunto;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EtCorreo = findViewById(R.id.EtCorreo);
EtAsunto = findViewById(R.id.EtAsunto);
EtMensaje = findViewById(R.id.EtMensaje);
btnEnviar = findViewById(R.id.btnEnviar);
btnEnviar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String correo = EtCorreo.getText().toString();
String asunto = EtAsunto.getText().toString();
String mensaje = EtMensaje.getText().toString();
if(correo.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa un correo", Toast.LENGTH_LONG).show();
}
else if(asunto.equals(""))
{
Toast.makeText(MainActivity.this,"ingresa el asunto", Toast.LENGTH_LONG).show();
}
else if(mensaje.equals(""))
{
Toast.makeText(MainActivity.this, "ingresa un mensaje", Toast.LENGTH_LONG).show();
}
else
{
// Defino mi intent y hago uso del objeto ACTION_SEND
// Intent intent = new Intent(Intent.ACTION_SENDTO);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL,
new String[]{correo});
intent.putExtra(Intent.EXTRA_SUBJECT,asunto);
intent.putExtra(Intent.EXTRA_TEXT, mensaje);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Elije un cliente de correo:"));
}
}
});
}
}
リトルビッグプラネット™2でアップロードsi desean verda click aquí コンEstoヘムターミネータデRealizarトドエルCは、dioエスペックque les sirva y esperen mを得ます.
HASTA LA近親相姦!
Reference
この問題について(アンドロイドスタジオ:Enviar Correoエレクトリック), 我々は、より多くの情報をここで見つけました https://dev.to/fynio/minitutorial-android-studio-enviar-correo-electronico-5af8テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol