I have a problem with resume Activity. I have a MainActivity which contains other activities. Each one contains a radio station. I have a button (Play) in each activity, and when the user clicks on it, the button changes its function to Stop, so it turns to Stop button. My problem is that when I go for example from Activity(B) to MainActivity and then return to Activity(B) instead of the Stop button, it shows again the Play button, and if the button is pressed, the player plays the same station again at the same moment. I tried to resume the activity using flag, but that didn't work.
My code looks like this:
if (position == 3) {
Intent intent = new Intent(RadioActivity.this, Taraf.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
}
And the manifest looks like this:
<activity
android:name=".SettingsActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop">
</activity>