0
I have this simple screen
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/etEmail"
android:layout_width="213dp"
android:layout_height="0dp"
android:layout_marginTop="217dp"
android:layout_marginBottom="9dp"
android:hint="Email:"
android:inputType="textEmailAddress"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="213dp"
android:layout_height="0dp"
android:layout_marginBottom="277dp"
android:onClick="receberEmail"
android:text="Enviar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etEmail" />
</androidx.constraintlayout.widget.ConstraintLayout>
And I have my mainactivity
package com.example.helloworld;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
public EditText etEmail;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.etEmail = findViewById(R.id.etEmail);
}
public void receberEmail(View view) {
String emailDoUsuario = etEmail.getText().toString();
//mandar email para o emailDoUsuario
}
}
I need to get the user to receive an email, IE, my algorithm will send an email to emailDoUsuario
, I already managed to save the user’s email in a variable, but how do I send an email to this address?
It worked but not as I need... I do not want the User to send an email, I want the User to receive an email, understood?
– Arthur Almeida