Exercise 1 - MC Lab (311118104020)
Exercise 1 - MC Lab (311118104020)
AIM:
To develop a single Android Application to change text on click.
Procedure:
Creating a New Project:
Step1: Open Android Studio and then click on File -> New -> New project.
Step2: Then type the Application name as “HelloWorld″ and click Next.
Step3: Then select the Minimum SDK as shown below and click Next.
Step4: Then select the Empty Activity and click Next.
Step5: Finally click Finish.
Step6: It will take some time to build and load the project.
Step7: After completion it will look as given below.
Designing layout for the Android Application:
Step8: Click on app -> res -> layout -> activity_main.xml.
Step9: Click on Design and drag and drop text view.
Java Coding for the Android Application:
Step10: Click on app -> java -> com.example.HelloWorld -> MainActivity.
Step11: Type the code given below.
<TextView
android:id="@+id/helloButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onHelloButtonClick"
android:text="Hello Amal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
OUTPUT:
RESULT:
Thus a Simple Android Application to change text on click is developed and executed successfully.