How to find out the Activity Intent name from which the user back-pressed (!) to the current Activity?

55 Views Asked by At

I have SettingsActivity + SettingsFragment + my CustomPreference with built into XML Intent for opening settings of Notification Channel:

preferences.xml:

    <my.package.CustomPreference
        android:title="Sound"
        app:summary="Selected: Mozart ringtone"
        app:key="my_sound"
        <intent android:action="android.settings.CHANNEL_NOTIFICATION_SETTINGS">
            <extra android:name="android.provider.extra.APP_PACKAGE" android:value="my.package"/>
            <extra android:name="android.provider.extra.CHANNEL_ID" android:value="my_channel"/>
        </intent>
    </my.package.CustomPreference>

When the user returns from the notification channel settings, I need to reread the summary field for my CustomPreference. What is the cleanest and most correct way to do this?

P.S. I only see an option overriding the SettingsActivity : onResume(), which redraws the SettingsFragment in the case that the previous activity was generated by the Intent android.settings.CHANNEL_NOTIFICATION_SETTINGS.

But I don't know how to find out.

0

There are 0 best solutions below