priya-zha / Software-Engineering-Project

0 stars 2 forks source link

FR #1 The application is pointing to another blank screen while user is trying to close the application #22

Open Manikothakota-git opened 11 months ago

Manikothakota-git commented 11 months ago

Steps to reproduce:

When the user is at his first screen of the application, and he presses back button the application needs to be closed.

Actual Result:

When the user is in home screen of the application and he presses the back button of his android device.The current program redirecting into an empty activity screen.

Expected Result: When the user is in home screen of the application and he presses the back button of his android device.The application should be closed.

Updated code

In GetStarted.java file: import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.os.Build; import android.os.Handler; import android.os.VibrationEffect; import android.os.Vibrator; import android.speech.RecognizerIntent; import android.speech.SpeechRecognizer;

import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle;

import com.example.se.R; import com.example.se.splash; import com.google.android.material.snackbar.Snackbar;

import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity;

import android.speech.tts.TextToSpeech; import android.speech.tts.UtteranceProgressListener; import android.view.View; import android.widget.Button; import android.widget.Toast;

import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.core.view.WindowCompat; import androidx.navigation.NavController; import androidx.navigation.Navigation; import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.NavigationUI;

import java.util.ArrayList;

public class GetStarted extends AppCompatActivity implements TextToSpeech.OnInitListener { // ... (other variables and methods)

@Override
public void onBackPressed() {
    // Handle the back button press

    moveTaskToBack(true); // Minimize the app or bring it to the background

}

// ... (rest of the code remains the same)

}

Before Fixing:

// These are video recording links https://github.com/priya-zha/Software-Engineering-Project/assets/143675898/1f387842-2486-4698-8be7-e5c7a2c60a12

After Fixing:

https://github.com/priya-zha/Software-Engineering-Project/assets/143675898/a0caeaa5-b730-4a4c-b3f4-b84d0e3ad7c7