i`d like to customize my app view, now is shown current activity type on the screen and got STOP button
i`d like to use cards from material design 3
card of current activity should contain stop/start button at its header
and contain 4 lines with previous recognized activities (last line shows current activity)
we`ve already got database class, so that doesnt be a problem

here some my current code:
public class MainActivity extends AppCompatActivity {

    private static final int ACTIVITY_RECOGNITION_REQUEST_CODE = 100;
    private TextView activityTextView;
    private Button stopButton;

    private BroadcastReceiver transitionBroadcastReceiver;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        activityTextView = findViewById(R.id.activityTextView);
        stopButton = findViewById(R.id.stopButton);

        // Request permission if not granted
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACTIVITY_RECOGNITION)
                != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.ACTIVITY_RECOGNITION},
                    ACTIVITY_RECOGNITION_REQUEST_CODE);
        } else {
            // Permission already granted
            startActivityRecognitionService();
            requestIgnoreBatteryOptimizations();
        }

        stopButton.setOnClickListener(v -> stopActivityRecognitionService());
    }

    private void startActivityRecognitionService() {
        Intent serviceIntent = new Intent(this, ActivityTransitionService.class);
        ContextCompat.startForegroundService(this, serviceIntent);

        // Register receiver to update UI
        transitionBroadcastReceiver = new BroadcastReceiver() {
            @SuppressLint("SetTextI18n")
            @Override
            public void onReceive(Context context, Intent intent) {
                String activityInfo = intent.getStringExtra("activity");
                activityTextView.setText(getString(R.string.current_activity) + activityInfo);
            }
        };
        LocalBroadcastManager.getInstance(this).registerReceiver(transitionBroadcastReceiver,
                new IntentFilter("TRANSITION_ACTION"));

        Toast.makeText(this, "Started activity recognition service", Toast.LENGTH_SHORT).show();
        stopButton.setVisibility(View.VISIBLE);
    }

    private void stopActivityRecognitionService() {
        Intent serviceIntent = new Intent(this, ActivityTransitionService.class);
        stopService(serviceIntent);

        if (transitionBroadcastReceiver != null) {
            LocalBroadcastManager.getInstance(this).unregisterReceiver(transitionBroadcastReceiver);
            transitionBroadcastReceiver = null;
        }

        Toast.makeText(this, "Stopped activity recognition service", Toast.LENGTH_SHORT).show();
        stopButton.setVisibility(View.GONE);
        activityTextView.setText(R.string.activity_monitoring_stopped);
    }

    private void requestIgnoreBatteryOptimizations() {
        PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
        String packageName = getPackageName();
        if (!pm.isIgnoringBatteryOptimizations(packageName)) {
            @SuppressLint("BatteryLife") Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
            intent.setData(android.net.Uri.parse("package:" + packageName));
            startActivity(intent);
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           @NonNull String[] permissions, @NonNull int[] grantResults) {
        if (requestCode == ACTIVITY_RECOGNITION_REQUEST_CODE) {
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                startActivityRecognitionService();
                requestIgnoreBatteryOptimizations();
            } else {
                Toast.makeText(this, "Permission denied", Toast.LENGTH_SHORT).show();
            }
        } else {
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        }
    }

    @Override
    protected void onDestroy() {
        stopActivityRecognitionService();
        super.onDestroy();
    }
}
public class DatabaseHelper extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "activity_transitions.db";
    private static final int DATABASE_VERSION = 1;

    private static final String TABLE_TRANSITIONS = "transitions";

    private static final String COLUMN_TIMESTAMP = "timestamp";
    private static final String COLUMN_ACTIVITY = "activity";
    private static final String COLUMN_TRANSITION = "transition";

    private static DatabaseHelper instance;

    public static void initializeInstance(Context context) {
        if (instance == null) {
            instance = new DatabaseHelper(context.getApplicationContext());
        }
    }

    public static DatabaseHelper getInstance() {
        if (instance == null) {
            throw new IllegalStateException("DatabaseHelper is not initialized, call initializeInstance(..) method first.");
        }
        return instance;
    }

    private DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String CREATE_TRANSITIONS_TABLE = "CREATE TABLE " + TABLE_TRANSITIONS + "(" + COLUMN_TIMESTAMP + " INTEGER," + COLUMN_ACTIVITY + " TEXT," + COLUMN_TRANSITION + " TEXT" + ")";
        db.execSQL(CREATE_TRANSITIONS_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // Handle database upgrade if needed
    }

    public void insertTransitionEvent(long timestamp, String activity, String transition) {
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(COLUMN_TIMESTAMP, timestamp);
        values.put(COLUMN_ACTIVITY, activity);
        values.put(COLUMN_TRANSITION, transition);

        db.insert(TABLE_TRANSITIONS, null, values);

        db.close();
    }

    // Optionally add methods to retrieve data from the database
}
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:padding="16dp">

    <TextView
        android:id="@+id/activityTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Current Activity: Unknown"
        android:textSize="18sp"
        android:padding="8dp" />

    <Button
        android:id="@+id/stopButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/stop_monitoring"
        android:padding="8dp"
        android:visibility="gone" /> <!-- Initially hidden -->
</LinearLayout>