Output Part 1
Output Part 1
age: 66
P
JAVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
Override
@
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
rogressBar = findViewById([Link]);
p
progressText = findViewById([Link]);
XML CODE:
_________________________________________________________________________
_________________________________________________________________________
<RelativeLayout xmlns:android="[Link]
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
style="?android:attr/progressBarStyleLarge"
android:max="100"/>
<TextView
android:id="@+id/progressText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0%"
android:textSize="20sp"
android:layout_centerInParent="true"/>
</RelativeLayout>
OUTPUT:
_________________________________________________________________________
_________________________________________________________________________
Page: 91
J AVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
Override
@
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
Log.d(TAG, "onCreate: Activity is being created");
}
Override
@
protected void onStart() {
[Link]();
Log.d(TAG, "onStart: Activity is becoming visible");
}
Override
@
protected void onResume() {
[Link]();
Log.d(TAG, "onResume: Activity is now interactive");
}
Override
@
protected void onPause() {
[Link]();
Log.d(TAG, "onPause: Activity is partially obscured");
}
Override
@
protected void onStop() {
[Link]();
Log.d(TAG, "onStop: Activity is no longer visible");
}
Override
@
protected void onRestart() {
[Link]();
Log.d(TAG, "onRestart: Activity is restarting");
}
Override
@
protected void onDestroy() {
[Link]();
_________________________________________________________________________
_________________________________________________________________________
ML CODE:
X
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:textSize="24sp"
android:layout_gravity="center"
android:layout_marginTop="16dp" />
</LinearLayout>
OUTPUT:
_________________________________________________________________________
_________________________________________________________________________
Page: 38
JAVA CODE:
ackage [Link];
p
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity {
Override
@
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
// Create a list of initial suggestions (replace with your actual data)
suggestionList = new ArrayList<>();
[Link]("Java Programming");
[Link]("Android Development");
[Link]("Python for Data Science");
[Link]("Web Development Tutorial");
[Link]("Machine Learning Basics");
[Link]("Artificial Intelligence Course");
[Link]("Mobile App Design");
[Link]("Database Management Systems");
[Link]("Competitive Programming");
// You can optionally set a threshold for when suggestions start appearing
// Default is 1, meaning suggestions appear after the first character is typed.
// [Link](2);
} }
ML CODE:
X
_________________________________________________________________________
_________________________________________________________________________
x mlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search Engine"
android:textSize="24sp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp" />
<AutoCompleteTextView
android:id="@+id/searchAutoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your search query"
android:completionThreshold="1" />
</LinearLayout>
OUTPUT:
_________________________________________________________________________
_________________________________________________________________________
Page: 39
J AVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity {
private AutoCompleteTextView subjectAutoCompleteTextView;
private List<String> sixthSemesterSubjects;
private ArrayAdapter<String> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
// Create a list of sixth semester subjects (replace with your actual subjects)
sixthSemesterSubjects = new ArrayList<>();
[Link]("Software Engineering");
[Link]("Computer Networks");
[Link]("Database Management Systems");
[Link]("Operating Systems");
[Link]("Web Technology");
[Link]("Data Mining and Warehousing");
[Link]("Mobile Application Development");
[Link]("Cryptography and Network Security");
[Link]("Artificial Intelligence");
[Link]("Cloud Computing");
_________________________________________________________________________
_________________________________________________________________________
ndroid:layout_height="match_parent"
a
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sixth Semester Subjects"
android:textSize="24sp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp" />
<AutoCompleteTextView
android:id="@+id/subjectAutoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter subject name"
android:completionThreshold="1" />
</LinearLayout>
OUTPUT:
_________________________________________________________________________
_________________________________________________________________________
Page: 45
J AVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
Override
@
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
luetoothToggleButton = findViewById([Link]);
b
bluetoothStatusTextView = findViewById([Link]);
bluetoothAdapter = [Link]();
_________________________________________________________________________
_________________________________________________________________________
Override
@
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
[Link](requestCode, resultCode, data);
if (requestCode == REQUEST_ENABLE_BT) {
if (resultCode == RESULT_OK) {
// Bluetooth has been enabled
updateBluetoothState();
} else if (resultCode == RESULT_CANCELED) {
// User declined to enable Bluetooth, revert the toggle state
[Link](false);
[Link]("Bluetooth enabling was cancelled.");
}
}
}
ML CODE:
X
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
_________________________________________________________________________
_________________________________________________________________________
ndroid:gravity="center"
a
android:padding="16dp"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bluetooth Toggle"
android:textSize="24sp"
android:layout_marginBottom="32dp" />
<ToggleButton
android:id="@+id/bluetoothToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="OFF"
android:textOn="ON"
android:textAllCaps="true" />
<TextView
android:id="@+id/bluetoothStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Bluetooth Status: Unknown"
android:textSize="18sp" />
</LinearLayout>
OUTPUT:
J AVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity implements [Link] {
_________________________________________________________________________
_________________________________________________________________________
ditTextFirstNumber = findViewById([Link]);
e
editTextSecondNumber = findViewById([Link]);
buttonAdd = findViewById([Link]);
buttonSubtract = findViewById([Link]);
buttonMultiply = findViewById([Link]);
buttonDivide = findViewById([Link]);
textViewResult = findViewById([Link]);
[Link](this);
b
[Link](this);
[Link](this);
[Link](this);
}
Override
@
public void onClick(View v) {
String num1Str = [Link]().toString();
String num2Str = [Link]().toString();
int id = [Link]();
_________________________________________________________________________
_________________________________________________________________________
}
result = num1 / num2;
}
[Link]("Result: " + [Link]("%.2f", result)); // Format to 2 decimal places
}
}
ML CODE:
X
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Simple Calculator"
android:textSize="24sp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp" />
<EditText
android:id="@+id/editTextFirstNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter First Number"
android:inputType="numberDecimal"
android:layout_marginBottom="8dp" />
<EditText
android:id="@+id/editTextSecondNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Second Number"
android:inputType="numberDecimal"
android:layout_marginBottom="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<Button
android:id="@+id/buttonAdd"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="+"
android:layout_marginEnd="4dp" />
<Button
android:id="@+id/buttonSubtract"
_________________________________________________________________________
_________________________________________________________________________
ndroid:layout_width="0dp"
a
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="-"
android:layout_marginEnd="4dp"
android:layout_marginStart="4dp" />
<Button
android:id="@+id/buttonMultiply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="x"
android:layout_marginEnd="4dp"
android:layout_marginStart="4dp" />
<Button
android:id="@+id/buttonDivide"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="/"
android:layout_marginStart="4dp" />
</LinearLayout>
<TextView
android:id="@+id/textViewResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Result: "
android:textSize="18sp"
android:layout_marginTop="24dp" />
/LinearLayout>
<
OUTPUT:
_________________________________________________________________________
_________________________________________________________________________
Page: 56
J AVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
_________________________________________________________________________
_________________________________________________________________________
ML CODE:
X
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 1" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 2" />
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 3" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 4" />
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 5" />
<Button
android:id="@+id/submitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:layout_marginTop="16dp" />
</LinearLayout>
OUTPUT:
_________________________________________________________________________
_________________________________________________________________________
age: 79
P
JAVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
Override
@
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
s howToastButton = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
showCustomToast("Message for you:\nYou have got mail!");
}
});
}
_________________________________________________________________________
_________________________________________________________________________
XML CODE:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Toast Example"
android:textSize="24sp"
android:layout_marginBottom="16dp" />
<Button
android:id="@+id/showToastButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Toast" />
</LinearLayout>
_________________________________________________________________________
_________________________________________________________________________
Page: 85
J AVA CODE:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
Override
@
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
s electedDateTextView = findViewById([Link]);
selectDateButton = findViewById([Link]);
selectedTimeTextView = findViewById([Link]);
selectTimeButton = findViewById([Link]);
calendar = [Link]();
dateFormatter = new SimpleDateFormat("dd-MM-yyyy", [Link]());
timeFormatter = new SimpleDateFormat("hh:mm a", [Link]());
[Link](new [Link]() {
@Override
public void onClick(View v) {
DatePickerDialog datePickerDialog = new DatePickerDialog([Link],
(view, year, monthOfYear, dayOfMonth) -> {
[Link](year, monthOfYear, dayOfMonth);
[Link]([Link]([Link]()));
},
[Link]([Link]),
[Link]([Link]),
_________________________________________________________________________
_________________________________________________________________________
[Link](Calendar.DAY_OF_MONTH));
[Link]();
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
TimePickerDialog timePickerDialog = new TimePickerDialog([Link],
(view, hourOfDay, minute) -> {
[Link](Calendar.HOUR_OF_DAY, hourOfDay);
[Link]([Link], minute);
[Link]([Link]([Link]()));
},
[Link](Calendar.HOUR_OF_DAY),
[Link]([Link]),
false); // Set true for 24-hour format, false for 12-hour format
[Link]();
}
});
}
}
ML CODE:
X
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Selected Date:"
android:textSize="18sp" />
<TextView
android:id="@+id/selectedDateTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
_________________________________________________________________________
_________________________________________________________________________
android:textSize="18sp" />
<Button
android:id="@+id/selectDateButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SELECT DATE" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Selected Time:"
android:textSize="18sp" />
<TextView
android:id="@+id/selectedTimeTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textSize="18sp" />
<Button
android:id="@+id/selectTimeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SELECT TIME" />
</LinearLayout>
</LinearLayout>
_________________________________________________________________________