androidd 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. androidd/__init__.py +1 -0
  2. androidd/cie1/activityCycle/MainActivity.kt +44 -0
  3. androidd/cie1/activityCycle/activity_main.xml +15 -0
  4. androidd/cie1/alert/MainActivity.kt +28 -0
  5. androidd/cie1/alert/activity_main.xml +14 -0
  6. androidd/cie1/autoCompleteText/MainActivity.kt +19 -0
  7. androidd/cie1/autoCompleteText/activity_main.xml +14 -0
  8. androidd/cie1/checkbox/MainActivity.kt +28 -0
  9. androidd/cie1/checkbox/activity_main.xml +32 -0
  10. androidd/cie1/customCheckbox/MainActivity.kt +20 -0
  11. androidd/cie1/customCheckbox/activity_main.xml +22 -0
  12. androidd/cie1/customCheckbox/custom_checkbox.xml +9 -0
  13. androidd/cie1/customRadio/MainActivity.kt +22 -0
  14. androidd/cie1/customRadio/activity_main.xml +28 -0
  15. androidd/cie1/customRadio/custom_checkbox.xml +9 -0
  16. androidd/cie1/customToast/MainActivity.kt +35 -0
  17. androidd/cie1/customToast/activity_main.xml +14 -0
  18. androidd/cie1/customToast/custom_toast.xml +23 -0
  19. androidd/cie1/datepicker/MainActivity.kt +31 -0
  20. androidd/cie1/datepicker/activity_main.xml +20 -0
  21. androidd/cie1/progressbar/MainActivity.kt +26 -0
  22. androidd/cie1/progressbar/activity_main.xml +21 -0
  23. androidd/cie1/ques1/MainActivity.kt +37 -0
  24. androidd/cie1/ques1/activity_main.xml +41 -0
  25. androidd/cie1/ques2/MainActivity.kt +41 -0
  26. androidd/cie1/ques2/activity_main.xml +66 -0
  27. androidd/cie1/ques3/AndroidManifest.xml +3 -0
  28. androidd/cie1/ques3/MainActivity.kt +29 -0
  29. androidd/cie1/ques3/activity_main.xml +30 -0
  30. androidd/cie1/radiobutton/MainActivity.kt +25 -0
  31. androidd/cie1/radiobutton/activity_main.xml +38 -0
  32. androidd/cie1/timePicker/MainActivity.kt +30 -0
  33. androidd/cie1/timePicker/activity_main.xml +20 -0
  34. androidd/cie1/toast/MainActivity.kt +18 -0
  35. androidd/cie1/toast/activity_main.xml +14 -0
  36. androidd/cie1/toggle/MainActivity.kt +20 -0
  37. androidd/cie1/toggle/activity_main.xml +23 -0
  38. androidd/madbmsj/IMPLICIT and EXPLICIT/Main Activity.kt +31 -0
  39. androidd/madbmsj/IMPLICIT and EXPLICIT/activity_main.xml +33 -0
  40. androidd/madbmsj/IMPLICIT and EXPLICIT/second.xml +16 -0
  41. androidd/madbmsj/IMPLICIT and EXPLICIT/secondactivity.kt +15 -0
  42. androidd/madbmsj/animation/MainActivity.kt +60 -0
  43. androidd/madbmsj/animation/activity_main.xml +122 -0
  44. androidd/madbmsj/animation/bounce.xml +17 -0
  45. androidd/madbmsj/animation/fad_in.xml +7 -0
  46. androidd/madbmsj/animation/fade_out.xml +8 -0
  47. androidd/madbmsj/animation/info.txt +2 -0
  48. androidd/madbmsj/animation/slide_down.xml +7 -0
  49. androidd/madbmsj/animation/slide_up.xml +7 -0
  50. androidd/madbmsj/animation/zoom_in.xml +11 -0
  51. androidd/madbmsj/animation/zoom_out.xml +11 -0
  52. androidd/madbmsj/canvas/MainActivity.kt +51 -0
  53. androidd/madbmsj/canvas/activity_main.xml +18 -0
  54. androidd/madbmsj/cie1/code.txt +719 -0
  55. androidd/madbmsj/cie1/sampleQuestion.txt +280 -0
  56. androidd/madbmsj/cie2/code.txt +1255 -0
  57. androidd/madbmsj/cie2/ques1/AndroidManifest.xml +2 -0
  58. androidd/madbmsj/cie2/ques1/MainActivity.kt +45 -0
  59. androidd/madbmsj/cie2/ques1/SecondActivity.kt +21 -0
  60. androidd/madbmsj/cie2/ques1/activity_main.xml +19 -0
  61. androidd/madbmsj/cie2/ques1/activity_second.xml +15 -0
  62. androidd/madbmsj/cie2/ques1/department_menu.xml +11 -0
  63. androidd/madbmsj/contextMenu/MainActivity.kt +37 -0
  64. androidd/madbmsj/contextMenu/activity_main.xml +19 -0
  65. androidd/madbmsj/contextMenu/info.txt +1 -0
  66. androidd/madbmsj/contextMenu/menu_main.xml +16 -0
  67. androidd/madbmsj/database/DatabaseHelper.kt +108 -0
  68. androidd/madbmsj/database/MainActivity.kt +151 -0
  69. androidd/madbmsj/database/activity_main.xml +55 -0
  70. androidd/madbmsj/database/dialog_update_student.xml +22 -0
  71. androidd/madbmsj/database/info.txt +4 -0
  72. androidd/madbmsj/datePicker/MainActivity.kt +23 -0
  73. androidd/madbmsj/datePicker/activity_main.xml +20 -0
  74. androidd/madbmsj/explicit/activity_main.xml +39 -0
  75. androidd/madbmsj/explicit/activity_second.xml +15 -0
  76. androidd/madbmsj/explicit/info.txt +6 -0
  77. androidd/madbmsj/explicit/mainactivity.kt +32 -0
  78. androidd/madbmsj/explicit/secondactivity.kt +27 -0
  79. androidd/madbmsj/fragment/MainActivity.kt +35 -0
  80. androidd/madbmsj/fragment/activity_main.xml +41 -0
  81. androidd/madbmsj/fragment/fragment_1.kt +24 -0
  82. androidd/madbmsj/fragment/fragment_1.xml +16 -0
  83. androidd/madbmsj/fragment/fragment_2.kt +17 -0
  84. androidd/madbmsj/fragment/fragnent_2.xml +16 -0
  85. androidd/madbmsj/fragment/info.txt +1 -0
  86. androidd/madbmsj/optionsMenu/MainActivity.kt +26 -0
  87. androidd/madbmsj/optionsMenu/activity_main.xml +18 -0
  88. androidd/madbmsj/optionsMenu/info.txt +1 -0
  89. androidd/madbmsj/optionsMenu/menu_main.xml +27 -0
  90. androidd/madbmsj/package.json +13 -0
  91. androidd/madbmsj/popMenu/MainActivity.kt +49 -0
  92. androidd/madbmsj/popMenu/activity_main.xml +19 -0
  93. androidd/madbmsj/popMenu/info.txt +1 -0
  94. androidd/madbmsj/popMenu/menu_main.xml +16 -0
  95. androidd/madbmsj/sharedpref/byJ/MainActivity.kt +34 -0
  96. androidd/madbmsj/sharedpref/byJ/activity_main.xml +28 -0
  97. androidd/madbmsj/sharedpref/shared1/activity_main.xml +64 -0
  98. androidd/madbmsj/sharedpref/shared1/mainactivity.kt +47 -0
  99. androidd/madbmsj/sharedpref/shared2/activity_main.xml +44 -0
  100. androidd/madbmsj/sharedpref/shared2/mainactivity.kt +57 -0
  101. androidd/madbmsj/spinner/MainActivity.kt +30 -0
  102. androidd/madbmsj/spinner/activity_main.xml +13 -0
  103. {androidd-0.0.1.dist-info → androidd-0.0.3.dist-info}/METADATA +1 -1
  104. androidd-0.0.3.dist-info/RECORD +106 -0
  105. androidd-0.0.3.dist-info/top_level.txt +1 -0
  106. androidd-0.0.1.dist-info/RECORD +0 -4
  107. androidd-0.0.1.dist-info/top_level.txt +0 -1
  108. {androidd-0.0.1.dist-info → androidd-0.0.3.dist-info}/WHEEL +0 -0
androidd/__init__.py ADDED
@@ -0,0 +1 @@
1
+ # This file makes the 'androidd' directory a Python package.
@@ -0,0 +1,44 @@
1
+ package com.example.practice
2
+
3
+ import android.os.Bundle
4
+ import android.support.v7.app.AppCompatActivity
5
+ import android.widget.Toast
6
+
7
+ class MainActivity : AppCompatActivity() {
8
+
9
+ override fun onCreate(savedInstanceState: Bundle?) {
10
+ super.onCreate(savedInstanceState)
11
+ setContentView(R.layout.activity_main)
12
+ Toast.makeText(this, "onCreate", Toast.LENGTH_SHORT).show()
13
+ }
14
+
15
+ override fun onStart() {
16
+ super.onStart()
17
+ Toast.makeText(this, "onStart", Toast.LENGTH_SHORT).show()
18
+ }
19
+
20
+ override fun onResume() {
21
+ super.onResume()
22
+ Toast.makeText(this, "onResume", Toast.LENGTH_SHORT).show()
23
+ }
24
+
25
+ override fun onPause() {
26
+ super.onPause()
27
+ Toast.makeText(this, "onPause", Toast.LENGTH_SHORT).show()
28
+ }
29
+
30
+ override fun onStop() {
31
+ super.onStop()
32
+ Toast.makeText(this, "onStop", Toast.LENGTH_SHORT).show()
33
+ }
34
+
35
+ override fun onRestart() {
36
+ super.onRestart()
37
+ Toast.makeText(this, "onRestart", Toast.LENGTH_SHORT).show()
38
+ }
39
+
40
+ override fun onDestroy() {
41
+ super.onDestroy()
42
+ Toast.makeText(this, "onDestroy", Toast.LENGTH_SHORT).show()
43
+ }
44
+ }
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical"
6
+ android:gravity="center"
7
+ android:padding="16dp">
8
+
9
+ <TextView
10
+ android:layout_width="wrap_content"
11
+ android:layout_height="wrap_content"
12
+ android:text="Activity Lifecycle Demo"
13
+ android:textSize="20sp"
14
+ android:textStyle="bold"/>
15
+ </LinearLayout>
@@ -0,0 +1,28 @@
1
+ package com.example.practice
2
+
3
+ import android.os.Bundle
4
+ import android.support.v7.app.AppCompatActivity
5
+ import android.support.v7.app.AlertDialog
6
+ import android.widget.Button
7
+ import android.widget.Toast
8
+
9
+ class MainActivity : AppCompatActivity() {
10
+ override fun onCreate(savedInstanceState: Bundle?) {
11
+ super.onCreate(savedInstanceState)
12
+ setContentView(R.layout.activity_main)
13
+
14
+ val btnShowDialog = findViewById<Button>(R.id.btnShowDialog)
15
+
16
+ btnShowDialog.setOnClickListener {
17
+ AlertDialog.Builder(this)
18
+ .setTitle("Exit Confirmation")
19
+ .setMessage("Do you really want to exit?")
20
+ .setPositiveButton("Yes") { _, _ ->
21
+ Toast.makeText(this, "Exiting...", Toast.LENGTH_SHORT).show()
22
+ finish()
23
+ }
24
+ .setNegativeButton("No", null)
25
+ .show()
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical"
6
+ android:gravity="center"
7
+ android:padding="24dp">
8
+
9
+ <Button
10
+ android:id="@+id/btnShowDialog"
11
+ android:layout_width="wrap_content"
12
+ android:layout_height="wrap_content"
13
+ android:text="Show Alert" />
14
+ </LinearLayout>
@@ -0,0 +1,19 @@
1
+ package com.example.practice
2
+
3
+ import android.os.Bundle
4
+ import android.support.v7.app.AppCompatActivity
5
+ import android.widget.ArrayAdapter
6
+ import android.widget.AutoCompleteTextView
7
+
8
+ class MainActivity : AppCompatActivity() {
9
+ override fun onCreate(savedInstanceState: Bundle?) {
10
+ super.onCreate(savedInstanceState)
11
+ setContentView(R.layout.activity_main)
12
+
13
+ val countries = arrayOf("India", "Indonesia", "Italy", "Iceland", "Iran")
14
+ val adapter = ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, countries)
15
+
16
+ val autoCompleteTextView = findViewById<AutoCompleteTextView>(R.id.autoCompleteTextView)
17
+ autoCompleteTextView.setAdapter(adapter)
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical"
6
+ android:padding="16dp">
7
+
8
+ <AutoCompleteTextView
9
+ android:id="@+id/autoCompleteTextView"
10
+ android:layout_width="match_parent"
11
+ android:layout_height="wrap_content"
12
+ android:hint="Enter a country"
13
+ android:completionThreshold="1" />
14
+ </LinearLayout>
@@ -0,0 +1,28 @@
1
+ package com.example.practice
2
+
3
+ import android.os.Bundle
4
+ import android.support.v7.app.AppCompatActivity
5
+ import android.widget.Button
6
+ import android.widget.CheckBox
7
+ import android.widget.Toast
8
+
9
+ class MainActivity : AppCompatActivity() {
10
+ override fun onCreate(savedInstanceState: Bundle?) {
11
+ super.onCreate(savedInstanceState)
12
+ setContentView(R.layout.activity_main)
13
+
14
+ val chkChocolate = findViewById<CheckBox>(R.id.chkChocolate)
15
+ val chkSprinkles = findViewById<CheckBox>(R.id.chkSprinkles)
16
+ val chkNuts = findViewById<CheckBox>(R.id.chkNuts)
17
+ val btnShow = findViewById<Button>(R.id.btnShow)
18
+
19
+ btnShow.setOnClickListener {
20
+ val selected = mutableListOf<String>()
21
+ if (chkChocolate.isChecked) selected.add("Chocolate")
22
+ if (chkSprinkles.isChecked) selected.add("Sprinkles")
23
+ if (chkNuts.isChecked) selected.add("Nuts")
24
+
25
+ Toast.makeText(this, "Selected: ${selected.joinToString()}", Toast.LENGTH_SHORT).show()
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical"
6
+ android:padding="16dp">
7
+
8
+ <CheckBox
9
+ android:id="@+id/chkChocolate"
10
+ android:layout_width="wrap_content"
11
+ android:layout_height="wrap_content"
12
+ android:text="Chocolate" />
13
+
14
+ <CheckBox
15
+ android:id="@+id/chkSprinkles"
16
+ android:layout_width="wrap_content"
17
+ android:layout_height="wrap_content"
18
+ android:text="Sprinkles" />
19
+
20
+ <CheckBox
21
+ android:id="@+id/chkNuts"
22
+ android:layout_width="wrap_content"
23
+ android:layout_height="wrap_content"
24
+ android:text="Nuts" />
25
+
26
+ <Button
27
+ android:id="@+id/btnShow"
28
+ android:layout_width="wrap_content"
29
+ android:layout_height="wrap_content"
30
+ android:text="Show Selection"
31
+ android:layout_marginTop="20dp"/>
32
+ </LinearLayout>
@@ -0,0 +1,20 @@
1
+ package com.example.practice
2
+
3
+ import android.os.Bundle
4
+ import android.support.v7.app.AppCompatActivity
5
+ import android.widget.*
6
+
7
+ class MainActivity : AppCompatActivity() {
8
+ override fun onCreate(savedInstanceState: Bundle?) {
9
+ super.onCreate(savedInstanceState)
10
+ setContentView(R.layout.activity_main)
11
+
12
+ val checkbox = findViewById<CheckBox>(R.id.checkboxCustom)
13
+ val button = findViewById<Button>(R.id.btnCheck)
14
+
15
+ button.setOnClickListener {
16
+ val msg = if (checkbox.isChecked) "Subscribed!" else "Not Subscribed!"
17
+ Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:orientation="vertical"
4
+ android:padding="24dp"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent">
7
+
8
+ <CheckBox
9
+ android:id="@+id/checkboxCustom"
10
+ android:layout_width="wrap_content"
11
+ android:layout_height="wrap_content"
12
+ android:text="Subscribe"
13
+ android:textSize="18sp"
14
+ android:button="@drawable/custom_checkbox" />
15
+
16
+ <Button
17
+ android:id="@+id/btnCheck"
18
+ android:layout_width="wrap_content"
19
+ android:layout_height="wrap_content"
20
+ android:text="Check Status"
21
+ android:layout_marginTop="16dp"/>
22
+ </LinearLayout>
@@ -0,0 +1,9 @@
1
+ // put this file in res/drawable folder
2
+
3
+ <?xml version="1.0" encoding="utf-8"?>
4
+ <selector xmlns:android="http://schemas.android.com/apk/res/android">
5
+ <item android:state_checked="true"
6
+ android:drawable="@android:drawable/checkbox_on_background" />
7
+ <item android:state_checked="false"
8
+ android:drawable="@android:drawable/checkbox_off_background" />
9
+ </selector>
@@ -0,0 +1,22 @@
1
+ package com.example.practice
2
+
3
+
4
+ import android.os.Bundle
5
+ import android.support.v7.app.AppCompatActivity
6
+ import android.widget.RadioButton
7
+ import android.widget.RadioGroup
8
+ import android.widget.Toast
9
+
10
+ class MainActivity : AppCompatActivity() {
11
+ override fun onCreate(savedInstanceState: Bundle?) {
12
+ super.onCreate(savedInstanceState)
13
+ setContentView(R.layout.activity_main)
14
+
15
+ val radioGroup = findViewById<RadioGroup>(R.id.radioGroup)
16
+
17
+ radioGroup.setOnCheckedChangeListener { _, checkedId ->
18
+ val radio = findViewById<RadioButton>(checkedId)
19
+ Toast.makeText(this, "Selected: ${radio.text}", Toast.LENGTH_SHORT).show()
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:orientation="vertical"
4
+ android:padding="24dp"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent">
7
+
8
+ <RadioGroup
9
+ android:id="@+id/radioGroup"
10
+ android:layout_width="wrap_content"
11
+ android:layout_height="wrap_content"
12
+ android:orientation="vertical">
13
+
14
+ <RadioButton
15
+ android:id="@+id/radio1"
16
+ android:layout_width="wrap_content"
17
+ android:layout_height="wrap_content"
18
+ android:text="Option 1"
19
+ android:button="@drawable/custom_checkbox"/>
20
+
21
+ <RadioButton
22
+ android:id="@+id/radio2"
23
+ android:layout_width="wrap_content"
24
+ android:layout_height="wrap_content"
25
+ android:text="Option 2"
26
+ android:button="@drawable/custom_checkbox"/>
27
+ </RadioGroup>
28
+ </LinearLayout>
@@ -0,0 +1,9 @@
1
+ // put this file in res/drawable folder
2
+
3
+ <?xml version="1.0" encoding="utf-8"?>
4
+ <selector xmlns:android="http://schemas.android.com/apk/res/android">
5
+ <item android:state_checked="true"
6
+ android:drawable="@android:drawable/checkbox_on_background" />
7
+ <item android:state_checked="false"
8
+ android:drawable="@android:drawable/checkbox_off_background" />
9
+ </selector>
@@ -0,0 +1,35 @@
1
+ package com.example.practice
2
+
3
+ import android.os.Bundle
4
+ import android.support.v7.app.AppCompatActivity
5
+ import android.view.LayoutInflater
6
+ import android.view.View
7
+ import android.widget.Button
8
+ import android.widget.TextView
9
+ import android.widget.Toast
10
+
11
+ class MainActivity : AppCompatActivity() {
12
+ override fun onCreate(savedInstanceState: Bundle?) {
13
+ super.onCreate(savedInstanceState)
14
+ setContentView(R.layout.activity_main)
15
+
16
+ val btn = findViewById<Button>(R.id.btnCustomToast)
17
+ btn.setOnClickListener {
18
+ showCustomToast()
19
+ }
20
+ }
21
+
22
+ private fun showCustomToast() {
23
+ val inflater: LayoutInflater = layoutInflater
24
+ val view: View = inflater.inflate(R.layout.custom_toast, null)
25
+
26
+ val text = view.findViewById<TextView>(R.id.toastText)
27
+ text.text = "Hello from Custom Toast!"
28
+
29
+ val toast = Toast(applicationContext)
30
+ toast.duration = Toast.LENGTH_SHORT
31
+ toast.view = view
32
+ toast.show()
33
+ }
34
+ }
35
+
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical"
6
+ android:gravity="center"
7
+ android:padding="16dp">
8
+
9
+ <Button
10
+ android:id="@+id/btnCustomToast"
11
+ android:layout_width="wrap_content"
12
+ android:layout_height="wrap_content"
13
+ android:text="Show Custom Toast" />
14
+ </LinearLayout>
@@ -0,0 +1,23 @@
1
+ // paste this code in same folder a activity_main.xml file
2
+ <?xml version="1.0" encoding="utf-8"?>
3
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4
+ android:orientation="horizontal"
5
+ android:layout_width="wrap_content"
6
+ android:layout_height="wrap_content"
7
+ android:background="#333"
8
+ android:padding="12dp">
9
+
10
+ <ImageView
11
+ android:src="@android:drawable/ic_dialog_info"
12
+ android:layout_width="24dp"
13
+ android:layout_height="24dp"
14
+ android:layout_marginEnd="8dp"/>
15
+
16
+ <TextView
17
+ android:id="@+id/toastText"
18
+ android:text="This is a custom toast!"
19
+ android:textColor="#FFF"
20
+ android:textSize="16sp"
21
+ android:layout_width="wrap_content"
22
+ android:layout_height="wrap_content"/>
23
+ </LinearLayout>
@@ -0,0 +1,31 @@
1
+ package com.example.practice
2
+
3
+ import android.app.DatePickerDialog
4
+ import android.os.Bundle
5
+ import android.support.v7.app.AppCompatActivity
6
+ import android.widget.Button
7
+ import android.widget.TextView
8
+ import java.util.*
9
+
10
+ class MainActivity : AppCompatActivity() {
11
+ override fun onCreate(savedInstanceState: Bundle?) {
12
+ super.onCreate(savedInstanceState)
13
+ setContentView(R.layout.activity_main)
14
+
15
+ val btnPickDate = findViewById<Button>(R.id.btnPickDate)
16
+ val tvSelectedDate = findViewById<TextView>(R.id.tvSelectedDate)
17
+
18
+ btnPickDate.setOnClickListener {
19
+ val calendar = Calendar.getInstance()
20
+ val year = calendar.get(Calendar.YEAR)
21
+ val month = calendar.get(Calendar.MONTH)
22
+ val day = calendar.get(Calendar.DAY_OF_MONTH)
23
+
24
+ val datePicker = DatePickerDialog(this, { _, y, m, d ->
25
+ tvSelectedDate.text = "Selected Date: $d/${m + 1}/$y"
26
+ }, year, month, day)
27
+
28
+ datePicker.show()
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical"
6
+ android:padding="16dp">
7
+
8
+ <Button
9
+ android:id="@+id/btnPickDate"
10
+ android:layout_width="wrap_content"
11
+ android:layout_height="wrap_content"
12
+ android:text="Pick Date" />
13
+
14
+ <TextView
15
+ android:id="@+id/tvSelectedDate"
16
+ android:layout_width="wrap_content"
17
+ android:layout_height="wrap_content"
18
+ android:paddingTop="16dp"
19
+ android:text="Selected Date will appear here" />
20
+ </LinearLayout>
@@ -0,0 +1,26 @@
1
+ package com.example.practice
2
+
3
+ import android.os.Bundle
4
+ import android.os.Handler
5
+ import android.os.Looper
6
+ import android.support.v7.app.AppCompatActivity
7
+ import android.view.View
8
+ import android.widget.Button
9
+ import android.widget.ProgressBar
10
+
11
+ class MainActivity : AppCompatActivity() {
12
+ override fun onCreate(savedInstanceState: Bundle?) {
13
+ super.onCreate(savedInstanceState)
14
+ setContentView(R.layout.activity_main)
15
+
16
+ val progressBar = findViewById<ProgressBar>(R.id.progressBar)
17
+ val btnLoad = findViewById<Button>(R.id.btnLoad)
18
+
19
+ btnLoad.setOnClickListener {
20
+ progressBar.visibility = View.VISIBLE
21
+ Handler(Looper.getMainLooper()).postDelayed({
22
+ progressBar.visibility = View.GONE
23
+ }, 3000) // Hide after 3 seconds
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:gravity="center"
6
+ android:orientation="vertical"
7
+ android:padding="16dp">
8
+
9
+ <ProgressBar
10
+ android:id="@+id/progressBar"
11
+ android:layout_width="wrap_content"
12
+ android:layout_height="wrap_content"
13
+ android:visibility="gone"
14
+ android:indeterminate="true" />
15
+
16
+ <Button
17
+ android:id="@+id/btnLoad"
18
+ android:layout_width="wrap_content"
19
+ android:layout_height="wrap_content"
20
+ android:text="Show Progress" />
21
+ </LinearLayout>
@@ -0,0 +1,37 @@
1
+ package com.example.labexam_01
2
+
3
+ import android.support.v7.app.AppCompatActivity
4
+ import android.os.Bundle
5
+ import android.view.View
6
+ import android.widget.CheckBox
7
+ import android.widget.TextView
8
+ import android.widget.Toast
9
+
10
+ class MainActivity : AppCompatActivity() {
11
+ override fun onCreate(savedInstanceState: Bundle?) {
12
+ super.onCreate(savedInstanceState)
13
+ setContentView(R.layout.activity_main)
14
+ }
15
+
16
+ fun calculateTotal(view: View) {
17
+ val book1 = findViewById<CheckBox>(R.id.book1)
18
+ val book2 = findViewById<CheckBox>(R.id.book2)
19
+ val book3 = findViewById<CheckBox>(R.id.book3)
20
+ val result = findViewById<TextView>(R.id.tvResult)
21
+
22
+ var total = 0
23
+
24
+ if (book1.isChecked) total += 120
25
+ if (book2.isChecked) total += 150
26
+ if (book3.isChecked) total += 200
27
+
28
+ val finalAmount = if (total > 300) total * 0.9 else total.toDouble()
29
+
30
+ if (total > 0) {
31
+ val discountText = if (total > 300) " (10% discount applied)" else ""
32
+ result.text = "Total: ₹${"%.2f".format(finalAmount)}$discountText"
33
+ } else {
34
+ Toast.makeText(this, "Please select at least one book", Toast.LENGTH_SHORT).show()
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical"
6
+ android:padding="16dp">
7
+
8
+ <CheckBox
9
+ android:id="@+id/book1"
10
+ android:text="Java - ₹120"
11
+ android:layout_width="wrap_content"
12
+ android:layout_height="wrap_content" />
13
+
14
+ <CheckBox
15
+ android:id="@+id/book2"
16
+ android:text="Kotlin - ₹150"
17
+ android:layout_width="wrap_content"
18
+ android:layout_height="wrap_content" />
19
+
20
+ <CheckBox
21
+ android:id="@+id/book3"
22
+ android:text="Android Dev - ₹200"
23
+ android:layout_width="wrap_content"
24
+ android:layout_height="wrap_content" />
25
+
26
+ <Button
27
+ android:id="@+id/btnCalculate"
28
+ android:text="Calculate Total"
29
+ android:layout_width="match_parent"
30
+ android:layout_height="wrap_content"
31
+ android:onClick="calculateTotal" />
32
+
33
+ <TextView
34
+ android:id="@+id/tvResult"
35
+ android:text="Total: ₹0"
36
+ android:textSize="18sp"
37
+ android:layout_marginTop="20dp"
38
+ android:layout_width="wrap_content"
39
+ android:layout_height="wrap_content" />
40
+
41
+ </LinearLayout>
@@ -0,0 +1,41 @@
1
+ package com.example.labexam_02
2
+
3
+ import android.support.v7.app.AppCompatActivity
4
+ import android.os.Bundle
5
+ import android.view.View
6
+ import android.widget.EditText
7
+ import android.widget.TextView
8
+ import android.widget.Toast
9
+
10
+ class MainActivity : AppCompatActivity() {
11
+
12
+ override fun onCreate(savedInstanceState: Bundle?) {
13
+ super.onCreate(savedInstanceState)
14
+ setContentView(R.layout.activity_main)
15
+ }
16
+
17
+ fun calculate(view: View) {
18
+ val num1 = findViewById<EditText>(R.id.num1).text.toString().toDoubleOrNull()
19
+ val num2 = findViewById<EditText>(R.id.num2).text.toString().toDoubleOrNull()
20
+ val resultView = findViewById<TextView>(R.id.tvResult)
21
+
22
+ if (num1 == null || num2 == null) {
23
+ Toast.makeText(this, "Enter valid numbers", Toast.LENGTH_SHORT).show()
24
+ return
25
+ }
26
+
27
+ val result = when (view.id) {
28
+ R.id.btnAdd -> num1 + num2
29
+ R.id.btnSub -> num1 - num2
30
+ R.id.btnMul -> num1 * num2
31
+ R.id.btnDiv -> if (num2 != 0.0) num1 / num2 else {
32
+ Toast.makeText(this, "Cannot divide by zero", Toast.LENGTH_SHORT).show()
33
+ return
34
+ }
35
+ else -> 0.0
36
+ }
37
+
38
+ resultView.text = "Result: $result"
39
+ }
40
+
41
+ }