Open
Conversation
motorro
reviewed
Nov 4, 2023
| startActivity(intent) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
@NanaOz, добавьте сюда, пожалуйста, переопределение метода onNewIntent с каким-нибудь логированием типа:
Log.w("A", "New intent")Таким образом, вы сможете проверить выполнение задания 3
| <activity | ||
| android:name=".ActivityA" | ||
| android:exported="true"> | ||
| <intent-filter> |
There was a problem hiding this comment.
@NanaOz , я бы использовал тут режим запуска singleTask. Почему:
- Задание 1:
при этом предусмотрите возможность открывать другие Activity в том же стеке где расположена ActivityA - Задание 3:
По клику на кнопку “Open ActivityA” запустите ActivityA, таким образом, чтобы мы попали на существующий экземпляр ActivityA и у него был вызван метод onNewIntent
В таком случае, мы можем и создавать активити выше по стеку в этой задаче и возвращаться в наш экземплят. Синглтоп, что вы используете во флагах вернется в тот же экземпляр только если он на верху стэка. А если он чем-то накрыт, то будет пересоздан. Вот тут, мне кажется, неплохая статейка с примерами
| // Обработка нажатия на кнопку "Close Stack" | ||
| val intent = Intent(this, ActivityA::class.java) | ||
| intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK | ||
| startActivity(intent) |
There was a problem hiding this comment.
@NanaOz, отлично! Это совместимый метод. Но рекомендую еще посмотреть метод finishAffinity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.