Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview In Module Three, you created a simple layout in Android Studio. For this assignment, you will build on the UI you already created and
Overview
In Module Three, you created a simple layout in Android Studio. For this assignment, you will build on the UI you already created and practice some simple coding with Android Studio. You should use this as an opportunity to continue getting a feel for the tool while also reviewing your skills.
Directions
Open the file you saved from the Module Three assignment in Android Studio, then edit the MainActivity.java file.
Specifically, you must address the following rubric criteria:
Create a function that displays a greeting.
In Android Studio, create a new public function named SayHello that returns a void. The function will need to accept a View as a parameter.
Within the function, ensure that the view displays a message and check that the contents of nameText are not null.
Create validation of the elements and inputs.
To complete this task, you must complete the following actions:
If the content of nameText is not null, write Hello and the contents of nameText to textGreeting.
If the content of nameText is null, you should just return from the function. This issue will be improved in the next bullet.
On activitymain.xml set the onClick of buttonSayHello to SayHello
Dynamically enable and disable the button settings for appropriate situations.
Set the buttonSayHello enabled attribute to False
Add a text changed listener to the nameText field and implement the following logic:
Dynamically disable buttonSayHello if there is no text in nameText.
Dynamically enable buttonSayHello when text is entered in nameText.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started