This is lesson 2 for Android App development for beginners in Urdu and Hindi. Today we will learn how to add button control in an Android application using Android studio. Further, it will be explained how to change attributes and properties of a button and other controls using XML and design in Android studio. In the end, we will see, we can attach an on-click listener with button control to make it clickable in Android studio with the help of two methods using XML are the on-click listener.
In this video demonstration, the following activities are performed in step by step to make sure that a beginner-level learner can easily learn Android app development. You can add all kinds of controls bi drag and drop from the control palette already discussed in lesson 1 about introduction to the Android studio interface.
Here is the code snippet that is discussed in the video when you will try to write on click listener functionality for a button control in an Android development application.
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
// Do something
}
});
Working with Button Controls in Android App Development
Today’s objective (Lesson2)
- Adding controls
- Adding button control
- Setting attributes/properties ( XML, Atttibute Sheet Desin)
- Attching java code
- Adding JAVA button onclicklistener
- Declare an object
- Attach this object with activity control