O
O
Orkhan Hasanli2018-08-15 15:11:18
Android
Orkhan Hasanli, 2018-08-15 15:11:18

How to "fix" the work of the "go back" button?

Hello!
I am developing a small application on android and I am facing the following problems:
First of all I am providing the code that I am using to implement the "go back" button on android

Android Manifest
<activity
            android:name=".FavoriteActivity"
            android:label="@string/title_activity_favorite"
            android:parentActivityName=".MainActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="info.md7.dermanlar.MainActivity" />
        </activity>

Activity
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

1) When I click on the RecyclerView (MainActivity) element using Parcelable, I pass the texts to the next InfoActivity and there is a button on click that opens the WebView and displays the table. If I add a "go back" button to the InfoActivity on the WebView, then I get an error, since this activity is already empty.
2) There are 2 activities - FavoriteActivity & MainActivity when clicking on the elements of which InfoActivity opens (+ texts using parcelable). How to return back depending on which activity the transition was from? Now I have no matter which activity he moved from, the return button will always return to MainActivity,

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question