Question

Using AndroidStudio Create a mobile app UI that has the following labels and textboxes. Customer Name...

Using AndroidStudio

Create a mobile app UI that has the following labels and textboxes.

  • Customer Name
  • Customer ID
  • Customer Address

The mobile app UI should also contain a Submit button. The following validation should be executed as soon as user clicks the Submit button.

  • Customer ID should be between 0-1000. If user enters any value above 1000, then you need to display an error message.
  • Customer Name should not contain any numeric characters. If user enters customer name with numbers, then display an error message.
  • Customer ID, Name, and Address are required fields. If user do not enter any of the values, then display the required field validation error message.

Once you build the UI, then create an additional screen that shows following things:

Customer OrderID(Label):__________

Order_Name(Label):__________

Order_Quantity:_____________

Order_FullfilledBy:____________

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE :-

1st Activity :-

It contains main page of the application, where validation is done.

xml file

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Customer Name:-"
            android:textSize="25dp"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/name"
            android:textSize="25dp"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Customer ID:-"
            android:textSize="25dp"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/id"
            android:inputType="number"
            android:textSize="25dp"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Customer Address:-"
            android:textSize="25dp"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/address"
            android:textSize="25dp"/>

    </LinearLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="submit"
        android:layout_gravity="center"
        android:layout_marginTop="50dp"
        android:id="@+id/submit"/>

</LinearLayout>

java file

package com.example.myapplication1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    EditText name,id,address;
    Button submit;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        name=findViewById(R.id.name);
        id=findViewById(R.id.id);
        address=findViewById(R.id.address);
        submit=findViewById(R.id.submit);

        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String Customer_name=name.getText().toString();
                String Customer_ID=id.getText().toString();
                String Customer_address=address.getText().toString();

                //this if will check that whether all the fields are filled or not.
                if(Customer_name.equals("") || Customer_ID.equals("") || Customer_address.equals(""))
                {
                    Toast.makeText(getApplicationContext(),"all the details are not filled",Toast.LENGTH_LONG).show();
                }
                //this else if will for both customer id and customer name are entered //correctlly or not
                else if(Integer.parseInt(Customer_ID)<0 || Integer.parseInt(Customer_ID)>=1000 && (Customer_name.contains("0") || Customer_name.contains("1")  || Customer_name.contains("2") || Customer_name.contains("3") || Customer_name.contains("4") || Customer_name.contains("5") || Customer_name.contains("6") || Customer_name.contains("7") || Customer_name.contains("8") || Customer_name.contains("9")))
                {
                    Toast.makeText(getApplicationContext(),"invalid CUSTOMER_NAME and CUSTOMER_ID",Toast.LENGTH_SHORT).show();
                }
                //this else will check for valid customer id and customer name.
                else
                {
                    if(Integer.parseInt(Customer_ID)<0 || Integer.parseInt(Customer_ID)>=1000 || (Customer_name.contains("0") || Customer_name.contains("1")  || Customer_name.contains("2") || Customer_name.contains("3") || Customer_name.contains("4") || Customer_name.contains("5") || Customer_name.contains("6") || Customer_name.contains("7") || Customer_name.contains("8") || Customer_name.contains("9")))
                   {


                       if(Integer.parseInt(Customer_ID)<0 || Integer.parseInt(Customer_ID)>1000)
                       {
                           Toast.makeText(getApplicationContext(),"invalid Customer_ID",Toast.LENGTH_SHORT).show();
                       }
                       if((Customer_name.contains("0") || Customer_name.contains("1")  || Customer_name.contains("2") || Customer_name.contains("3") || Customer_name.contains("4") || Customer_name.contains("5") || Customer_name.contains("6") || Customer_name.contains("7") || Customer_name.contains("8") || Customer_name.contains("9")))
                       {
                           Toast.makeText(getApplicationContext(),"invalid Customer_Name",Toast.LENGTH_SHORT).show();
                       }
                   }
                    //if all the valid details are filled and all the conditions satisfied  //than this else will execute and take us to another page.
                    else
                    {
                        Intent i=new Intent(getApplicationContext(),Main2Activity.class);
                        startActivity(i);
                    }
                }
            }
        });
    }
}

*************************************************************************************************

2nd Activity :-

It contains the 2nd page which will open after clicking on submit button.

xml file

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".Main2Activity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Customer OrderID:-"
            android:textSize="25dp"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/id"
            android:textSize="25dp"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Order_Name:-"
            android:textSize="25dp"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/name"
            android:textSize="25dp"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Order_Quantity:-"
            android:textSize="25dp"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/qty"
            android:textSize="25dp"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Order_FullfilledBy:-"
            android:textSize="25dp"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/fill"
            android:textSize="25dp"/>

    </LinearLayout>

</LinearLayout>

java file

package com.example.myapplication1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class Main2Activity extends AppCompatActivity {

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

************************************************************************************************

OUTPUT :-

TE: 1:59 MyApplication1 Customer Name:-James Customer ID:- 123 Customer Address:- xyz SUBMIT O 0 0   | E1:59 MyApplication1 Customer OrderID:-| Order_Name:- Order_Quantity:- Order_FullfilledBy:- O 0 0

the E: 2:02 MyApplication1 Customer Name:-James21 Customer ID:- 12321 Customer Address:- xyz SUBMIT invalid CUSTOMER_NAME andthe : 52:03 MyApplication1 Customer Name:-James Customer ID:- 12321 Customer Address:- xyz SUBMIT invalid Customer_IDthe | | | 2:04 MyApplication1 Customer Name:-James21 Customer ID:- 123 Customer Address:- xyz SUBMIT invalid Customer_Name   the | | | 2:04 MyApplication1 Customer Name:-James Customer ID:- Customer Address:- xyz SUBMIT all the details are not filled

Add a comment
Know the answer?
Add Answer to:
Using AndroidStudio Create a mobile app UI that has the following labels and textboxes. Customer Name...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Android Studios. Scenario: You recently started working as the mobile app developer for a University...

    Using Android Studios. Scenario: You recently started working as the mobile app developer for a University and have been assigned to build a mobile app that calculates the students' grade. Your app should contain following screens: Screen 1 Labels for subject1, subject2, and subject3 Textboxes for subject1, subject2, and subject3 Labels for MaxGrade, MinGrade, and Avg.Grade Submit button Once user clicks submit button, you need to display letter grade in a label Screen 2 Screen that allows students to register...

  • This assignemnt for Android development using Java Weather Forecaster App Goal: Create an app to display...

    This assignemnt for Android development using Java Weather Forecaster App Goal: Create an app to display a weather forecast for the user’s current location Create the app titled Weather Forecaster The first screen will have a textbox for the user to enter a zip code and a button to submit When the user enters the zip code and clicks the button, the app will navigate to the weather forecast screen. The weather forecast screen will show the current weather for...

  • Using C#: Create a Form that consists of 3 radio buttons, two textboxes, a label and...

    Using C#: Create a Form that consists of 3 radio buttons, two textboxes, a label and a button. The three radio buttons should represent the names of three fonts, e.g. “Arial”, “Calibri” and “Times New Roman”. In the one textbox, a user should type a message and in the other textbox, the user should type a size. When the user clicks the button, the label should be updated with the text the user typed in the one textbox, using the...

  • Please help! Visual Basic - Windows App Form .NET Framework. ​Option Explicit ON ​Option Strict ON...

    Please help! Visual Basic - Windows App Form .NET Framework. ​Option Explicit ON ​Option Strict ON ​Option Infer ON calculate Letter Grade Number grade: I Letter grade: Calculate Exxt Start a new Project named GradeConverter Add labels, textboxes, and button to the default form. Create an event handler for Calculate and Exit. . When the user enters a number- between 0.0 and 100.0 and clicks Calculate, the letter grade will display for the user The form should be able to...

  • Exercise 11-4 Create a Reminder app In this exercise, you’ll add a service to a Reminder...

    Exercise 11-4 Create a Reminder app In this exercise, you’ll add a service to a Reminder app that displays a notification every hour that says, “Look into the distance. It’s good for your eyes.” Test the app 1. Start Android Studio and open the project named ch11_ex4_Reminder. 2. Review the code. Note that it contains a layout and a class for an activity, but no class for a service. 1. Run the app. Note that it displays a message that...

  • HELP! Event Handling- Develop an event handler to handle onclick Form Validation event when a user...

    HELP! Event Handling- Develop an event handler to handle onclick Form Validation event when a user clicks the submit button on the Survey Form. The event handler should validate the following: o The Name tesxt box should contain only Alphabets. o The Address text boxes should contain only appropriate numeric, alphabet or alphanumeric characters o Make sure at least two checkboxes are checked. o Make sure a radio button option is selected. o The Email Address should be valid. Validate...

  • Your app is computing and displaying tax for the user, in the format “Hello John Doe,...

    Your app is computing and displaying tax for the user, in the format “Hello John Doe, Your Tax is: ......” , where John Doe is the name entered, and .... indicates the tax amount as a dollar figure. Your form has two textboxes, where the user will enter his/her name, and income, and click a Submit button. Your app will store the name entered by the user into a variable of type String, and store the income into a variable...

  • Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows...

    Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows users to register and login into the system. The focus of this project is for you to create an app with several activities and has data validation. You should have for your app: A welcome screen (splash screen) with your app name and a picture. You should then move to a screen that asks the user for either to log in or to register....

  • In this lab assignment, you'll write code that parses an email address and formats the ci and zip...

    Using Microsoft Visual Studio C# In this lab assignment, you'll write code that parses an email address and formats the ci and zip code portion of an address. String Handling Email: [email protected] Parse City: Fresno State: ca Zp code: 93722 Format ให้ 2 Parsed String Formatted String User name: anne Domain name: murach.comm City, State, Zip: Fresno, CA 93722 OK OK Create a new Windows Forms Application named StringHandling and build the form as shown above. 1. Add code to...

  • NEED HELP DIRECTIONS: Notice that there is one input area and two buttons There is a...

    NEED HELP DIRECTIONS: Notice that there is one input area and two buttons There is a place in the HTML reserved for < li > elements under the heading “Shopping List” Write a javascript program that will cause whatever the user inputs to be placed in a newly -created < li > tag and the tag placed inside the < ul > element whenever the user clicks the button Your program must not create any < li > tag is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT