androj 0.1.0__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 (46) hide show
  1. androj/__init__.py +82 -0
  2. androj/examples/airplane/AirplaneModeReceiver.java +29 -0
  3. androj/examples/airplane/AndroidManifest.xml +23 -0
  4. androj/examples/airplane/FILES.txt +8 -0
  5. androj/examples/airplane/MainActivity.java +35 -0
  6. androj/examples/alarm/AlarmReceiver.java +15 -0
  7. androj/examples/alarm/AndroidManifest.xml +29 -0
  8. androj/examples/alarm/FILES.txt +8 -0
  9. androj/examples/alarm/MainActivity.java +76 -0
  10. androj/examples/alert/FILES.txt +6 -0
  11. androj/examples/alert/MainActivity.java +48 -0
  12. androj/examples/battery_low/AndroidManifest.xml +23 -0
  13. androj/examples/battery_low/BatteryLowReceiver.java +21 -0
  14. androj/examples/battery_low/FILES.txt +8 -0
  15. androj/examples/battery_low/MainActivity.java +36 -0
  16. androj/examples/context_menu/FILES.txt +7 -0
  17. androj/examples/context_menu/MainActivity.java +54 -0
  18. androj/examples/context_menu/activity_main.xml +16 -0
  19. androj/examples/date_time/FILES.txt +6 -0
  20. androj/examples/date_time/MainActivity.java +42 -0
  21. androj/examples/explicit_intents/ConfirmActivity.java +37 -0
  22. androj/examples/explicit_intents/DetailsActivity.java +48 -0
  23. androj/examples/explicit_intents/FILES.txt +8 -0
  24. androj/examples/explicit_intents/MainActivity.java +109 -0
  25. androj/examples/library_database/DBHelper.java +94 -0
  26. androj/examples/library_database/FILES.txt +7 -0
  27. androj/examples/library_database/MainActivity.java +114 -0
  28. androj/examples/listview_gridview/DBHelper.java +52 -0
  29. androj/examples/listview_gridview/FILES.txt +7 -0
  30. androj/examples/listview_gridview/MainActivity.java +87 -0
  31. androj/examples/options_menu/FILES.txt +7 -0
  32. androj/examples/options_menu/MainActivity.java +39 -0
  33. androj/examples/options_menu/main_activity.xml +7 -0
  34. androj/examples/radio_checkbox/FILES.txt +7 -0
  35. androj/examples/radio_checkbox/MainActivity.java +75 -0
  36. androj/examples/radio_checkbox/activity_main.xml +10 -0
  37. androj/examples/sms_email_call/FILES.txt +6 -0
  38. androj/examples/sms_email_call/MainActivity.java +97 -0
  39. androj/examples/two_activities/FILES.txt +7 -0
  40. androj/examples/two_activities/MainActivity.java +31 -0
  41. androj/examples/two_activities/activity_second.java +23 -0
  42. androj-0.1.0.dist-info/METADATA +68 -0
  43. androj-0.1.0.dist-info/RECORD +46 -0
  44. androj-0.1.0.dist-info/WHEEL +5 -0
  45. androj-0.1.0.dist-info/licenses/LICENSE +17 -0
  46. androj-0.1.0.dist-info/top_level.txt +1 -0
androj/__init__.py ADDED
@@ -0,0 +1,82 @@
1
+ """
2
+ androj: Export Android Java/XML practical examples into your current project folder.
3
+
4
+ Each public example function creates:
5
+ ./andro_examples/<example-name>/
6
+
7
+ and copies the matching Java/XML source files there.
8
+ """
9
+
10
+ from pathlib import Path
11
+ from shutil import copy2
12
+ from importlib.resources import files
13
+
14
+ __version__ = "0.1.0"
15
+
16
+ _EXAMPLES = {
17
+ "airplane": "Listen for the Airplane Mode changed system broadcast.",
18
+ "alarm": "Basic AlarmManager and BroadcastReceiver example.",
19
+ "alert": "AlertDialog example.",
20
+ "battery_low": "Listen for the system battery-low broadcast.",
21
+ "context_menu": "Context menu example for changing a background color.",
22
+ "date_time": "Display date and time in different formats.",
23
+ "explicit_intents": "Three-activity example using explicit intents and extras.",
24
+ "library_database": "SQLite library-management example.",
25
+ "listview_gridview": "SQLite product list using ListView and GridView.",
26
+ "options_menu": "Options menu example.",
27
+ "radio_checkbox": "RadioButton and CheckBox example.",
28
+ "sms_email_call": "Implicit intents for SMS, email, and phone dialer.",
29
+ "two_activities": "Navigate between two activities using an explicit intent.",
30
+ }
31
+
32
+ def _export_example(name: str) -> Path:
33
+ """Copy one example's bundled source files into ./andro_examples/<name>/."""
34
+ if name not in _EXAMPLES:
35
+ raise ValueError(f"Unknown example: {name}")
36
+
37
+ destination = Path.cwd() / "andro_examples" / name
38
+ destination.mkdir(parents=True, exist_ok=True)
39
+
40
+ source_folder = files("androj").joinpath("examples", name)
41
+ for item in source_folder.iterdir():
42
+ if item.is_file():
43
+ with item.open("rb") as source, (destination / item.name).open("wb") as target:
44
+ target.write(source.read())
45
+
46
+ print(f"Downloaded/exported '{name}' example to: {destination}")
47
+ return destination
48
+
49
+ def help() -> str:
50
+ """Print the available androj functions and return the same help text."""
51
+ lines = [
52
+ "androj - Android practical source exporter",
53
+ "",
54
+ "Available functions:",
55
+ ]
56
+ for name, description in _EXAMPLES.items():
57
+ lines.append(f" androj.{name}()")
58
+ lines.append(f" {description}")
59
+ lines += [
60
+ "",
61
+ "Each function exports its source files to:",
62
+ " ./andro_examples/<example-name>/",
63
+ ]
64
+ message = "\n".join(lines)
65
+ print(message)
66
+ return message
67
+
68
+ def airplane(): return _export_example("airplane")
69
+ def alarm(): return _export_example("alarm")
70
+ def alert(): return _export_example("alert")
71
+ def battery_low(): return _export_example("battery_low")
72
+ def context_menu(): return _export_example("context_menu")
73
+ def date_time(): return _export_example("date_time")
74
+ def explicit_intents(): return _export_example("explicit_intents")
75
+ def library_database(): return _export_example("library_database")
76
+ def listview_gridview(): return _export_example("listview_gridview")
77
+ def options_menu(): return _export_example("options_menu")
78
+ def radio_checkbox(): return _export_example("radio_checkbox")
79
+ def sms_email_call(): return _export_example("sms_email_call")
80
+ def two_activities(): return _export_example("two_activities")
81
+
82
+ __all__ = ["help", *_EXAMPLES.keys()]
@@ -0,0 +1,29 @@
1
+ package com.example.myapp; // Keep your own package name
2
+
3
+ import android.content.BroadcastReceiver;
4
+ import android.content.Context;
5
+ import android.content.Intent;
6
+ import android.widget.Toast;
7
+
8
+ public class AirplaneModeReceiver extends BroadcastReceiver {
9
+
10
+ @Override
11
+ public void onReceive(Context context, Intent intent) {
12
+
13
+ if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())) {
14
+
15
+ boolean isAirplaneModeOn =
16
+ intent.getBooleanExtra("state", false);
17
+
18
+ String message;
19
+
20
+ if (isAirplaneModeOn) {
21
+ message = "Airplane Mode is ON";
22
+ } else {
23
+ message = "Airplane Mode is OFF";
24
+ }
25
+
26
+ Toast.makeText(context, message, Toast.LENGTH_LONG).show();
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+ <application
5
+ android:allowBackup="true"
6
+ android:label="Airplane Mode App"
7
+ android:supportsRtl="true"
8
+ android:theme="@style/Theme.MyApplication">
9
+
10
+ <activity
11
+ android:name=".MainActivity"
12
+ android:exported="true">
13
+
14
+ <intent-filter>
15
+ <action android:name="android.intent.action.MAIN" />
16
+ <category android:name="android.intent.category.LAUNCHER" />
17
+ </intent-filter>
18
+
19
+ </activity>
20
+
21
+ </application>
22
+
23
+ </manifest>
@@ -0,0 +1,8 @@
1
+ Example: Airplane
2
+
3
+ Files included:
4
+ - MainActivity.java
5
+ - AirplaneModeReceiver.java
6
+ - AndroidManifest.xml
7
+
8
+ These are the source snippets supplied for this example. You may need to add or adapt layout resources, package names, theme names, and manifest entries in Android Studio.
@@ -0,0 +1,35 @@
1
+ package com.example.myapp; // Keep your own package name
2
+
3
+ import android.content.IntentFilter;
4
+ import android.os.Bundle;
5
+ import android.widget.TextView;
6
+
7
+ import androidx.appcompat.app.AppCompatActivity;
8
+
9
+ public class MainActivity extends AppCompatActivity {
10
+
11
+ TextView tvStatus;
12
+ AirplaneModeReceiver receiver;
13
+
14
+ @Override
15
+ protected void onCreate(Bundle savedInstanceState) {
16
+ super.onCreate(savedInstanceState);
17
+ setContentView(R.layout.activity_main);
18
+
19
+ tvStatus = findViewById(R.id.tvStatus);
20
+ receiver = new AirplaneModeReceiver();
21
+
22
+ IntentFilter filter =
23
+ new IntentFilter("android.intent.action.AIRPLANE_MODE");
24
+
25
+ registerReceiver(receiver, filter);
26
+
27
+ tvStatus.setText("Receiver registered. Change Airplane Mode to test.");
28
+ }
29
+
30
+ @Override
31
+ protected void onDestroy() {
32
+ super.onDestroy();
33
+ unregisterReceiver(receiver);
34
+ }
35
+ }
@@ -0,0 +1,15 @@
1
+ package com.example.myapp; // Keep your own package name
2
+
3
+ import android.content.BroadcastReceiver;
4
+ import android.content.Context;
5
+ import android.content.Intent;
6
+ import android.widget.Toast;
7
+
8
+ public class AlarmReceiver extends BroadcastReceiver {
9
+
10
+ @Override
11
+ public void onReceive(Context context, Intent intent) {
12
+ Toast.makeText(context, "Alarm! Time to wake up!",
13
+ Toast.LENGTH_LONG).show();
14
+ }
15
+ }
@@ -0,0 +1,29 @@
1
+ <uses-permission
2
+ android:name="android.permission.SCHEDULE_EXACT_ALARM" />
3
+
4
+ <application
5
+ android:allowBackup="true"
6
+ android:icon="@mipmap/ic_launcher"
7
+ android:label="Alarm Clock"
8
+ android:roundIcon="@mipmap/ic_launcher_round"
9
+ android:supportsRtl="true"
10
+ android:theme="@style/Theme.MyApplication">
11
+
12
+ <receiver
13
+ android:name=".AlarmReceiver"
14
+ android:enabled="true"
15
+ android:exported="false" />
16
+
17
+ <activity
18
+ android:name=".MainActivity"
19
+ android:exported="true">
20
+
21
+ <intent-filter>
22
+ <action android:name="android.intent.action.MAIN" />
23
+
24
+ <category android:name="android.intent.category.LAUNCHER" />
25
+ </intent-filter>
26
+
27
+ </activity>
28
+
29
+ </application>
@@ -0,0 +1,8 @@
1
+ Example: Alarm
2
+
3
+ Files included:
4
+ - MainActivity.java
5
+ - AlarmReceiver.java
6
+ - AndroidManifest.xml
7
+
8
+ These are the source snippets supplied for this example. You may need to add or adapt layout resources, package names, theme names, and manifest entries in Android Studio.
@@ -0,0 +1,76 @@
1
+ package com.example.myapp;
2
+
3
+ import android.app.AlarmManager;
4
+ import android.app.PendingIntent;
5
+ import android.content.Context;
6
+ import android.content.Intent;
7
+ import android.os.Bundle;
8
+ import android.widget.Button;
9
+ import android.widget.TimePicker;
10
+ import android.widget.Toast;
11
+
12
+ import androidx.appcompat.app.AppCompatActivity;
13
+
14
+ import java.util.Calendar;
15
+
16
+ public class MainActivity extends AppCompatActivity {
17
+
18
+ TimePicker timePicker;
19
+ Button btnSetAlarm, btnCancelAlarm;
20
+ AlarmManager alarmManager;
21
+ PendingIntent pendingIntent;
22
+
23
+ @Override
24
+ protected void onCreate(Bundle savedInstanceState) {
25
+ super.onCreate(savedInstanceState);
26
+ setContentView(R.layout.activity_main);
27
+
28
+ timePicker = findViewById(R.id.timePicker);
29
+ btnSetAlarm = findViewById(R.id.btnSetAlarm);
30
+ btnCancelAlarm = findViewById(R.id.btnCancelAlarm);
31
+
32
+ alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
33
+
34
+ Intent intent = new Intent(this, AlarmReceiver.class);
35
+
36
+ pendingIntent = PendingIntent.getBroadcast(
37
+ this,
38
+ 0,
39
+ intent,
40
+ PendingIntent.FLAG_UPDATE_CURRENT |
41
+ PendingIntent.FLAG_IMMUTABLE
42
+ );
43
+
44
+ btnSetAlarm.setOnClickListener(v -> setAlarm());
45
+
46
+ btnCancelAlarm.setOnClickListener(v -> cancelAlarm());
47
+ }
48
+
49
+ private void setAlarm() {
50
+ int hour = timePicker.getHour();
51
+ int minute = timePicker.getMinute();
52
+
53
+ Calendar calendar = Calendar.getInstance();
54
+ calendar.set(Calendar.HOUR_OF_DAY, hour);
55
+ calendar.set(Calendar.MINUTE, minute);
56
+ calendar.set(Calendar.SECOND, 0);
57
+
58
+ // If the selected time has already passed, schedule it for tomorrow
59
+ if (calendar.getTimeInMillis() <= System.currentTimeMillis()) {
60
+ calendar.add(Calendar.DAY_OF_YEAR, 1);
61
+ }
62
+
63
+ alarmManager.setExact(
64
+ AlarmManager.RTC_WAKEUP,
65
+ calendar.getTimeInMillis(),
66
+ pendingIntent
67
+ );
68
+
69
+ Toast.makeText(this, "Alarm set!", Toast.LENGTH_SHORT).show();
70
+ }
71
+
72
+ private void cancelAlarm() {
73
+ alarmManager.cancel(pendingIntent);
74
+ Toast.makeText(this, "Alarm cancelled", Toast.LENGTH_SHORT).show();
75
+ }
76
+ }
@@ -0,0 +1,6 @@
1
+ Example: Alert
2
+
3
+ Files included:
4
+ - MainActivity.java
5
+
6
+ These are the source snippets supplied for this example. You may need to add or adapt layout resources, package names, theme names, and manifest entries in Android Studio.
@@ -0,0 +1,48 @@
1
+ package com.example.alertapp;
2
+
3
+ import android.os.Bundle;
4
+ import android.view.View;
5
+ import android.widget.Button;
6
+ import android.widget.EditText;
7
+ import android.widget.Toast;
8
+
9
+ import androidx.activity.EdgeToEdge;
10
+ import androidx.appcompat.app.AlertDialog;
11
+ import androidx.appcompat.app.AppCompatActivity;
12
+ import androidx.core.graphics.Insets;
13
+ import androidx.core.view.ViewCompat;
14
+ import androidx.core.view.WindowInsetsCompat;
15
+
16
+ public class MainActivity extends AppCompatActivity {
17
+ Button btn;
18
+ EditText et;
19
+ @Override
20
+ protected void onCreate(Bundle savedInstanceState) {
21
+ super.onCreate(savedInstanceState);
22
+ EdgeToEdge.enable(this);
23
+ setContentView(R.layout.activity_main);
24
+ btn=findViewById(R.id.btn);
25
+ et=findViewById(R.id.et);
26
+ btn.setOnClickListener(v -> showAlert());
27
+
28
+ }
29
+ public void showAlert() {
30
+ String st = et.getText().toString();
31
+ AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
32
+
33
+ builder.setTitle("Alert");
34
+ builder.setMessage(st);
35
+
36
+ builder.setPositiveButton("Yes", (dialog, which) -> {
37
+ Toast.makeText(MainActivity.this,
38
+ "You clicked Yes", Toast.LENGTH_SHORT).show();
39
+ });
40
+
41
+ builder.setNegativeButton("No", (dialog, which) -> {
42
+ Toast.makeText(MainActivity.this,
43
+ "You clicked No", Toast.LENGTH_SHORT).show();
44
+ });
45
+
46
+ builder.show();
47
+ }
48
+ }
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+ <application
5
+ android:allowBackup="true"
6
+ android:label="Battery Low App"
7
+ android:supportsRtl="true"
8
+ android:theme="@style/Theme.MyApplication">
9
+
10
+ <activity
11
+ android:name=".MainActivity"
12
+ android:exported="true">
13
+
14
+ <intent-filter>
15
+ <action android:name="android.intent.action.MAIN" />
16
+ <category android:name="android.intent.category.LAUNCHER" />
17
+ </intent-filter>
18
+
19
+ </activity>
20
+
21
+ </application>
22
+
23
+ </manifest>
@@ -0,0 +1,21 @@
1
+ package com.example.myapp; // Keep your own package name
2
+
3
+ import android.content.BroadcastReceiver;
4
+ import android.content.Context;
5
+ import android.content.Intent;
6
+ import android.widget.Toast;
7
+
8
+ public class BatteryLowReceiver extends BroadcastReceiver {
9
+
10
+ @Override
11
+ public void onReceive(Context context, Intent intent) {
12
+
13
+ if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) {
14
+ Toast.makeText(
15
+ context,
16
+ "Battery is low!",
17
+ Toast.LENGTH_LONG
18
+ ).show();
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,8 @@
1
+ Example: Battery Low
2
+
3
+ Files included:
4
+ - MainActivity.java
5
+ - BatteryLowReceiver.java
6
+ - AndroidManifest.xml
7
+
8
+ These are the source snippets supplied for this example. You may need to add or adapt layout resources, package names, theme names, and manifest entries in Android Studio.
@@ -0,0 +1,36 @@
1
+ package com.example.myapp; // Keep your own package name
2
+
3
+ import android.content.Intent;
4
+ import android.content.IntentFilter;
5
+ import android.os.Bundle;
6
+ import android.widget.TextView;
7
+
8
+ import androidx.appcompat.app.AppCompatActivity;
9
+
10
+ public class MainActivity extends AppCompatActivity {
11
+
12
+ TextView tvStatus;
13
+ BatteryLowReceiver receiver;
14
+
15
+ @Override
16
+ protected void onCreate(Bundle savedInstanceState) {
17
+ super.onCreate(savedInstanceState);
18
+ setContentView(R.layout.activity_main);
19
+
20
+ tvStatus = findViewById(R.id.tvStatus);
21
+ receiver = new BatteryLowReceiver();
22
+
23
+ IntentFilter filter =
24
+ new IntentFilter(Intent.ACTION_BATTERY_LOW);
25
+
26
+ registerReceiver(receiver, filter);
27
+
28
+ tvStatus.setText("Receiver registered. Waiting for low battery...");
29
+ }
30
+
31
+ @Override
32
+ protected void onDestroy() {
33
+ super.onDestroy();
34
+ unregisterReceiver(receiver);
35
+ }
36
+ }
@@ -0,0 +1,7 @@
1
+ Example: Context Menu
2
+
3
+ Files included:
4
+ - MainActivity.java
5
+ - activity_main.xml
6
+
7
+ These are the source snippets supplied for this example. You may need to add or adapt layout resources, package names, theme names, and manifest entries in Android Studio.
@@ -0,0 +1,54 @@
1
+ package com.example.contextmenuapp;
2
+
3
+ import android.os.Bundle;
4
+ import android.view.ContextMenu;
5
+ import android.view.MenuItem;
6
+ import android.view.View;
7
+ import android.widget.LinearLayout;
8
+
9
+ import androidx.appcompat.app.AppCompatActivity;
10
+
11
+ public class MainActivity extends AppCompatActivity {
12
+
13
+ LinearLayout layout;
14
+
15
+ @Override
16
+ protected void onCreate(Bundle savedInstanceState) {
17
+ super.onCreate(savedInstanceState);
18
+ setContentView(R.layout.activity_main);
19
+
20
+ layout = findViewById(R.id.layout);
21
+
22
+ registerForContextMenu(layout);
23
+ }
24
+
25
+ @Override
26
+ public void onCreateContextMenu(ContextMenu menu, View v,
27
+ ContextMenu.ContextMenuInfo menuInfo) {
28
+ super.onCreateContextMenu(menu, v, menuInfo);
29
+
30
+ menu.setHeaderTitle("Choose Background Color");
31
+
32
+ menu.add(0, 1, 0, "Red");
33
+ menu.add(0, 2, 1, "Green");
34
+ menu.add(0, 3, 2, "Blue");
35
+ }
36
+
37
+ @Override
38
+ public boolean onContextItemSelected(MenuItem item) {
39
+ int id = item.getItemId();
40
+
41
+ if (id == 1) {
42
+ layout.setBackgroundColor(android.graphics.Color.RED);
43
+ return true;
44
+ } else if (id == 2) {
45
+ layout.setBackgroundColor(android.graphics.Color.GREEN);
46
+ return true;
47
+ } else if (id == 3) {
48
+ layout.setBackgroundColor(android.graphics.Color.BLUE);
49
+ return true;
50
+ }
51
+
52
+ return super.onContextItemSelected(item);
53
+ }
54
+ }
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout
3
+ xmlns:android="http://schemas.android.com/apk/res/android"
4
+ android:id="@+id/layout"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent"
7
+ android:orientation="vertical"
8
+ android:gravity="center">
9
+
10
+ <TextView
11
+ android:layout_width="wrap_content"
12
+ android:layout_height="wrap_content"
13
+ android:text="Long press to change color"
14
+ android:textSize="22sp" />
15
+
16
+ </LinearLayout>
@@ -0,0 +1,6 @@
1
+ Example: Date Time
2
+
3
+ Files included:
4
+ - MainActivity.java
5
+
6
+ These are the source snippets supplied for this example. You may need to add or adapt layout resources, package names, theme names, and manifest entries in Android Studio.
@@ -0,0 +1,42 @@
1
+ package com.example.dateapp;
2
+
3
+ import android.os.Bundle;
4
+ import android.widget.TextView;
5
+
6
+ import androidx.activity.EdgeToEdge;
7
+ import androidx.appcompat.app.AppCompatActivity;
8
+ import androidx.core.graphics.Insets;
9
+ import androidx.core.view.ViewCompat;
10
+ import androidx.core.view.WindowInsetsCompat;
11
+
12
+ import java.text.SimpleDateFormat;
13
+ import java.util.Date;
14
+ import java.util.Locale;
15
+
16
+ public class MainActivity extends AppCompatActivity {
17
+
18
+ @Override
19
+ protected void onCreate(Bundle savedInstanceState) {
20
+ super.onCreate(savedInstanceState);
21
+ EdgeToEdge.enable(this);
22
+ setContentView(R.layout.activity_main);
23
+ TextView tv1=findViewById(R.id.tv2);
24
+ TextView tv2=findViewById(R.id.tv3);
25
+ TextView tv3=findViewById(R.id.tv4);
26
+ TextView tv4=findViewById(R.id.tv5);
27
+ TextView tv5=findViewById(R.id.tv6);
28
+
29
+ Date cur=new Date();
30
+
31
+ SimpleDateFormat f1=new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
32
+ SimpleDateFormat f2=new SimpleDateFormat("EEE, MMMM dd,yyyy", Locale.getDefault());
33
+ SimpleDateFormat f3=new SimpleDateFormat("hh:mm:ss: a", Locale.getDefault());
34
+ SimpleDateFormat f4=new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
35
+
36
+ tv1.setText(f1.format(cur));
37
+ tv2.setText(f2.format(cur));
38
+ tv3.setText(f3.format(cur));
39
+ tv4.setText(f4.format(cur));
40
+
41
+ }
42
+ }
@@ -0,0 +1,37 @@
1
+ package com.example.intentapp;
2
+
3
+ import android.content.Intent;
4
+ import android.os.Bundle;
5
+ import android.widget.TextView;
6
+
7
+ import androidx.activity.EdgeToEdge;
8
+ import androidx.appcompat.app.AppCompatActivity;
9
+ import androidx.core.graphics.Insets;
10
+ import androidx.core.view.ViewCompat;
11
+ import androidx.core.view.WindowInsetsCompat;
12
+
13
+ public class ConfirmActivity extends AppCompatActivity {
14
+
15
+ TextView tvConfirmation;
16
+
17
+ @Override
18
+ protected void onCreate(Bundle savedInstanceState) {
19
+ super.onCreate(savedInstanceState);
20
+ setContentView(R.layout.activity_confirm);
21
+
22
+ tvConfirmation = findViewById(R.id.tvConfirmation);
23
+
24
+ Intent intent = getIntent();
25
+
26
+ String name = intent.getStringExtra("name");
27
+ String course = intent.getStringExtra("course");
28
+ String facilities = intent.getStringExtra("facilities");
29
+
30
+ tvConfirmation.setText(
31
+ "Registration Successful!\n\n"
32
+ + "Name: " + name
33
+ + "\nCourse: " + course
34
+ + "\nFacilities: " + facilities
35
+ );
36
+ }
37
+ }