votopec
votopec

Reputation: 73

Android App restarts after settings activity exits on some devices

I have created an Android app and, when launching Settings Activity, on most devices after returning it goes back to the main app screen without restarting. On my Huawei P30 pro, for some reason, it restarts the original app. Why would I have such different behavior? I use AppCompatActivity which shows PreferenceFragmentCompat fragment

Upvotes: 0

Views: 65

Answers (1)

votopec
votopec

Reputation: 73

Fixed it with:

supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
  

in OnCreate()

and then:

override fun onSupportNavigateUp(): Boolean {
    Log.d(TAG,"Navigate Up clicked")
    onBackPressed()
    return true
}

in the activity

Upvotes: 0

Related Questions