Practica RFC y Curp Karla Jahazel Jacome Santos
Practica RFC y Curp Karla Jahazel Jacome Santos
Practica RFC y Curp Karla Jahazel Jacome Santos
Determine el id para los PlainText uno como txtUser, el otro como txtPass y el button como
btnAceptar
<EditText
android:id="@+id/txtUser"
android:layout_width="313dp"
android:layout_height="67dp"
android:layout_marginStart="55dp"
android:layout_marginTop="26dp"
android:layout_marginEnd="55dp"
android:layout_marginBottom="32dp"
android:ems="10"
android:inputType=""
android:hint="Usuario:"
android:textSize="15dp"
app:layout_constraintBottom_toTopOf="@+id/textView3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textview1" />
<EditText
android:id="@+id/txtPass"
android:layout_width="313dp"
android:layout_height="67dp"
android:layout_marginStart="60dp"
android:layout_marginTop="39dp"
android:layout_marginEnd="55dp"
android:layout_marginBottom="230dp"
android:hint="Contraseña"
android:ems="10"
android:inputType="textPassword"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.571"
app:layout_constraintStart_toStartOf="parent"
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
app:layout_constraintTop_toBottomOf="@+id/textView3"
app:layout_constraintVertical_bias="1.0" />
<Button
android:id="@+id/btnAceptar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="158dp"
android:layout_marginTop="38dp"
android:layout_marginEnd="158dp"
android:layout_marginBottom="144dp"
android:onClick="btnAceptar"
android:text="INICIAR SESION"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtPass" />
package com.example.login;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
//SE HACE LA DECLARACION DE LAS VARIALES PARA LOS EDITTEXT Y EL BUTTON
EditText txtUser, txtPass;
Button siguiente;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
}
else {
Toast.makeText(this,"Tu usuario o contraseña es incorrecto
",Toast.LENGTH_LONG).show();
}
}
}
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
Aquí nos mostrara en la misma pantalla ya que se hayan obtenido los datos dependiendo el botón
que se selecione si es RFC o si genera el CURP
<?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=".CURP">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="366dp"
android:layout_height="42dp"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/editTextNombre"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ems="10"
android:hint="Nombre (s)"
android:inputType="textPersonName"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="360dp"
android:layout_height="38dp"
android:layout_marginStart="22dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="21dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<EditText
android:id="@+id/editTextAP"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ems="10"
android:inputType="textPersonName"
android:hint="Apellido Paterno" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="363dp"
android:layout_height="41dp"
android:layout_marginStart="22dp"
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
android:layout_marginEnd="22dp"
android:layout_marginBottom="15dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3">
<EditText
android:id="@+id/editTextAM"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ems="10"
android:inputType="textPersonName"
android:hint="Apellido Materno" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="366dp"
android:layout_height="26dp"
android:layout_marginStart="21dp"
android:layout_marginEnd="27dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<Spinner
android:id="@+id/spinnerAnio"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout7"
android:layout_width="213dp"
android:layout_height="40dp"
android:layout_marginStart="21dp"
android:layout_marginEnd="180dp"
android:layout_marginBottom="17dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout8"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout6">
<LinearLayout
android:layout_width="184dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioButtonM"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Mujer" />
<RadioButton
android:id="@+id/radioButtonH"
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Hombre" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout8"
android:layout_width="356dp"
android:layout_height="26dp"
android:layout_marginStart="21dp"
android:layout_marginEnd="35dp"
android:layout_marginBottom="6dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout7">
<Spinner
android:id="@+id/spinnerE"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout9"
android:layout_width="130dp"
android:layout_height="39dp"
android:layout_marginStart="35dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="17dp"
android:layout_marginBottom="15dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout11"
app:layout_constraintEnd_toStartOf="@+id/linearLayout12"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout8">
<Button
android:id="@+id/buttonRFC"
android:layout_width="match_parent"
android:layout_height="37dp"
android:onClick="Aceptarrfc"
android:text="RFC" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout11"
android:layout_width="128dp"
android:layout_height="38dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="17dp"
android:layout_marginBottom="9dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout13"
app:layout_constraintEnd_toStartOf="@+id/linearLayout10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout9">
<Button
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
android:id="@+id/buttonCURP"
android:layout_width="match_parent"
android:layout_height="36dp"
android:onClick="Aceptarcurp"
android:text="CURP" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout5"
android:layout_width="356dp"
android:layout_height="25dp"
android:layout_marginStart="21dp"
android:layout_marginEnd="29dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout4">
<Spinner
android:id="@+id/spinnerMes"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout6"
android:layout_width="357dp"
android:layout_height="24dp"
android:layout_marginStart="22dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="11dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout5">
<Spinner
android:id="@+id/spinnerDia"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout12"
android:layout_width="211dp"
android:layout_height="40dp"
android:layout_marginStart="17dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="27dp"
android:layout_marginBottom="15dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout10"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/linearLayout9"
app:layout_constraintTop_toBottomOf="@+id/linearLayout8">
<TextView
android:id="@+id/textViewMRFC"
android:layout_width="match_parent"
android:layout_height="38dp"
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
/>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout10"
android:layout_width="209dp"
android:layout_height="31dp"
android:layout_marginStart="13dp"
android:layout_marginEnd="25dp"
android:layout_marginBottom="9dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linearLayout13"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/linearLayout11"
app:layout_constraintTop_toBottomOf="@+id/linearLayout12">
<TextView
android:id="@+id/textViewMCURP"
android:layout_width="match_parent"
android:layout_height="30dp"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout13"
android:layout_width="114dp"
android:layout_height="51dp"
android:orientation="vertical"
tools:layout_editor_absoluteX="26dp"
tools:layout_editor_absoluteY="460dp">
<Button
android:id="@+id/buttonNuevo"
android:layout_width="111dp"
android:layout_height="wrap_content"
android:onClick="borrartodo"
android:text="Nuevo" />
</LinearLayout>
<LinearLayout
android:layout_width="107dp"
android:layout_height="48dp"
android:orientation="vertical"
tools:layout_editor_absoluteX="156dp"
tools:layout_editor_absoluteY="463dp">
<Button
android:id="@+id/buttonImprimir"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Imprimir" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_curp);
//LE DECIMOS QUE DEPENDIENDO DE LAS VARIABLES SE HAGA UNA BUSQUEDA MEDIANTE EL ID
Nombre = (EditText) findViewById(R.id.editTextNombre);
ApellidoPaterno = (EditText) findViewById(R.id.editTextAP);
ApellidoMaterno = (EditText) findViewById(R.id.editTextAM);
//OCUPAMOS UN BUCLE FOR PARA INDICARLE EL NUMERO DE ITERACIONES QUE DEBE REALIZAR
ArrayList<String> anio = new ArrayList();
for (int i = 1800; i < 2020; i++) {
anio.add(i + "");
}
dias.add("0" + i);
} else
dias.add("0"+i+"");
}
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, anio);
Anio.setAdapter(adapter1);
ArrayAdapter<CharSequence> adapter4 =
ArrayAdapter.createFromResource(this, R.array.Entidad,
android.R.layout.simple_spinner_item);
Entidad.setAdapter(adapter4);
items = getResources().getStringArray(R.array.Entidad);
}
public void Aceptarrfc (View v) {
Toast.makeText(getApplicationContext(),"RFC"+RFC,Toast.LENGTH_LONG).show();
}
public void Aceptarcurp (View v){
String CURP = "";
String vocal = "";
CURP += ApellidoPaterno.getText().toString().substring(0,
1).toUpperCase();
for (int i = 1; i < (ApellidoPaterno.getText().toString().length() - 1);
i++) {
vocal = ApellidoPaterno.getText().toString().substring(i, i +
1).toUpperCase();
if (vocal.equals("A") || vocal.equals("E") || vocal.equals("I") ||
vocal.equals("0") || vocal.equals("U")) {
CURP += vocal;
break;
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
}
}
//AQUI DETERMIONAMOS LA POSICION DE NOMBRE, AÑO, MES,DIA PARA QUE HAGA LA
VALIDACION CORRESPONDIENTE
CURP += ApellidoMaterno.getText().toString().substring(0,
1).toUpperCase();
CURP += Nombre.getText().toString().substring(0, 1).toUpperCase();
CURP += Anio.getSelectedItem().toString().substring(2, 4);
CURP += Mes.getSelectedItem().toString().substring(0, 2);
CURP += Dia.getSelectedItem().toString().substring(0, 2);
}
if (items.equals("Michoacán")) {
CURP += "MN";
}
if (items.equals("Morelos")) {
CURP += "MS";
}
if (items.equals("Nayarit")) {
CURP += "NT";
}
if (items.equals("Nuevo León")) {
CURP += "NL";
}
if (items.equals("Oaxaca")) {
CURP += "OC";
}
if (items.equals("Puebla")) {
CURP += "PL";
}
if (items.equals("Querétaro")) {
CURP += "QT";
}
if (items.equals("Quintana Roo")) {
CURP += "QR";
}
if (items.equals("San Luis Potosí")) {
CURP += "SP";
}
if (items.equals("Sinaloa")) {
CURP += "SL";
}
if (items.equals("Sonora")) {
CURP += "SN";
}
if (items.equals("Tabasco")) {
CURP += "TC";
}
if (items.equals("Tamaulipas")) {
CURP += "TS";
}
if (items.equals("Tlaxcala")) {
CURP += "TL";
}
if (items.equals("Veracruz")) {
CURP += "VZ";
}
if (items.equals("Yucatán")) {
CURP += "YN";
}
if (items.equals("Zacatecas")) {
CURP += "ZS";
}
CURP += ApellidoPaterno.getText().toString().substring(
2,3).toUpperCase();
CURP += ApellidoMaterno.getText().toString().substring(2,
3).toUpperCase();
CURP += Nombre.getText().toString().substring(2,3).toUpperCase();
CURP += "99";
textViewMensajecurp.setText(CURP);
}
//LIMPIAMOS LAS CASILLAS MEDIANTE EL BOTON NUEVO
public void borrartodo (View v){
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
Nombre.setText("");
ApellidoPaterno.setText("");
ApellidoMaterno.setText("");
Mujer.setText("");
Hombre.setText("");
textViewMensajecurp.setText("");
textViewMensajerfc.setText("");
}
}
<item> Morelos</item>
<item> Nayarit</item>
<item> Nuevo León</item>
<item> Oaxaca</item>
<item> Puebla</item>
<item> Querétaro</item>
<item> Quintana Roo</item>
<item> San Luis Potosí</item>
<item> Sinaloa</item>
<item> Sonora</item>
<item> Tabasco</item>
<item> Tlaxcala</item>
<item> Tamaulipas</item>
<item> Veracruz</item>
<item> Yucatán</item>
<item> Zacatecas</item>
</string-array>
</resources>
CAPTURAS DE FUNCIONALIDAD:
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC
KARLA JAHAZEL JACOME SANTOS- PRACTICA LOGIN, CURP Y RFC