Skip to content

Commit

Permalink
exit when back button pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
sahsisunny committed May 1, 2023
1 parent c5a131e commit 730f5aa
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import androidx.activity.addCallback
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.sahsisunny.gittrackr.R
Expand Down Expand Up @@ -34,6 +35,9 @@ class HomeFragment : Fragment() {
exitButton.setOnClickListener {
requireActivity().finish()
}
requireActivity().onBackPressedDispatcher.addCallback {
requireActivity().finish()
}
return view
}

Expand Down

0 comments on commit 730f5aa

Please sign in to comment.