ava Validation Programming Android   [User Name]   User can input value (a~z) (A~Z). User cannot input value number between 0 and 9. Show an error if user input it. User cannot input value contains symbol (ex: !@#$). Show an error if user input it. User must fill the form to proceed, Show an error if fill form is empty. User only able to input value less than 30 characters. Show an error if exceed.     With the validation described above. By using xml layout below, use Android Studio and the Java programming language to solve this question.   How to solve this in MainActivity.java?     =============================== activity_main.xml                         =============================== MainActivity.java   package mobile.test.testvalidationname; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity {     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         EditText editText_username = findViewById(R.id.editText_username);         Button button_confirm= findViewById(R.id.button_confirm);         button_confirm.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {             }         });     } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Java Validation Programming Android

 

[User Name]

 

  1. User can input value (a~z) (A~Z).
  2. User cannot input value number between 0 and 9. Show an error if user input it.
  3. User cannot input value contains symbol (ex: !@#$). Show an error if user input it.
  4. User must fill the form to proceed, Show an error if fill form is empty.
  5. User only able to input value less than 30 characters. Show an error if exceed.

 

 

  • With the validation described above.
  • By using xml layout below, use Android Studio and the Java programming language to solve this question.

 

How to solve this in MainActivity.java?

 

 

===============================

activity_main.xml

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        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"
        tools:context=".MainActivity"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >

        <EditText
            android:id="@+id/editText_username"
            android:layout_marginTop="150dp"
            android:layout_width="300dp"
            android:layout_height="wrap_content"
            android:hint="User Name"
            android:textAlignment="center"
            android:layout_gravity="center"
            android:text="" />

        <Button
            android:id="@+id/button_confirm"
            android:layout_marginTop="100dp"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:textAlignment="center"
            android:layout_gravity="center"
            android:text="Confirm" />


</LinearLayout>

 

 

 

===============================

MainActivity.java

 

package mobile.test.testvalidationname;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        EditText editText_username = findViewById(R.id.editText_username);
        Button button_confirm= findViewById(R.id.button_confirm);


        button_confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {



            }
        });

    }
}

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY