Mad 2.2 Uday
Mad 2.2 Uday
Experiment 2.2
1. Aim:
Create an Android App using various controls such TexEdit, CheckBox,
RadioButton, RadioGroup, etc.
2. Objective:
The objective of an Android app using various controls such as EditText, CheckBox,
RadioButton, and RadioGroup could be to create a user interface that involves user input,
selection, and interaction with different types of controls. This type of app aims to showcase
the usage and functionalities of these UI elements to enhance the user experience.
3. Procedure:
System Requirements:
The required tools to develop Android applications are open source and can be
downloaded from the Web. Following is the list of software's we will need
before start our Android application programming. Android Studio
Java JDK 21.0.1 version
4. Code:
• MainActivity.kt
XML:-
<TextView
android:id="@+id/textViewExample"
android:layout_width="166dp"
android:layout_height="98dp"
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
<EditText
android:id="@+id/editTextExample"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter text"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="67dp" />
<ImageView
android:id="@+id/imageViewExample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher_foreground" />
<CheckBox
android:id="@+id/checkBoxExample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check me" />
<Spinner
android:id="@+id/spinnerExample"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/progressBarExample"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="50" />
<Switch
android:id="@+id/switchExample2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Switch me" />
<ToggleButton
android:id="@+id/toggleButtonExample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="ON"
android:textOff="OFF" />
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
<AutoCompleteTextView
android:id="@+id/autoCompleteTextViewExample"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Type here" />
</androidx.constraintlayout.widget.ConstraintLayout>
Java Code:-
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ch = (CheckBox) findViewById(R.id.checkBox);
ch1 = (CheckBox) findViewById(R.id.checkBox2);
ch2 = (CheckBox) findViewById(R.id.checkBox3);
ch3 = (CheckBox) findViewById(R.id.checkBox4);
}
// Separate class
import android.widget.Button
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.ui.tooling.preview.Preview
import com.example.intent.ui.theme.IntentTheme
6. Learning Outcome:
• Successful USE of your Android development environment.
• Project Workspace.
• Configuration button Completion.
• How to add new Intent.