Conversation
app/src/main/AndroidManifest.xml
Outdated
| <activity | ||
| android:name=".MainActivityA" | ||
| android:exported="true" | ||
| android:launchMode="singleInstance"> |
There was a problem hiding this comment.
@Serovatova , сингл-инстанс тут не подойдет, потому что в первом задании написано:
при этом предусмотрите возможность открывать другие Activity в том же стеке где расположена ActivityA
А вот, что написано в документации:
The "singleInstance" mode also differs from "singleTask" and "singleInstancePerTask" in only one respect: an activity with the "singleTask" or "singleInstancePerTask" launch mode lets other activities, necessarily "standard" and "singleTop" activities, be part of its task.
A "singleInstance" activity, on the other hand, permits no other activities to be part of its task. It must be the only activity in the task. If it starts another activity, that activity is assigned to a different task, as if FLAG_ACTIVITY_NEW_TASK were in the intent.
app/src/main/AndroidManifest.xml
Outdated
| <activity | ||
| android:name=".MainActivityC" | ||
| android:exported="false" | ||
| android:launchMode="singleTask"> |
There was a problem hiding this comment.
тут нам сингл-таск, вроде бы, не нужен. Для запуска в отдельном таске можно или taskAffinity применить, или флажками вытащить активити Б на другой таск, а дальше уже оно само
| } | ||
| startActivity(intent) | ||
| } | ||
| } |
There was a problem hiding this comment.
Я б тут советовал завести метод onNewIntent, чтобы легче было проверить третье задание
| val intent = Intent(this, MainActivityC::class.java) | ||
| startActivity(intent) | ||
| } | ||
| button2.setOnClickListener { |
There was a problem hiding this comment.
Кнопки перехода на активити А тут быть не должно
| } | ||
|
|
||
| startActivity(intent) | ||
| } |
There was a problem hiding this comment.
Отсутствует преход на активити А с закрытием стека
|
|
||
| val button = findViewById<Button>(R.id.button_clear_D) | ||
|
|
||
| button.setOnClickListener { |
|
|
||
|
|
||
| button2.setOnClickListener { | ||
| val intent = Intent(this,MainActivityB::class.java).apply { |
There was a problem hiding this comment.
По заданию, явного перехода на активити Б с активити Ц нет. Должна быть кнопка завершения активити Ц
| val button = findViewById<Button>(R.id.button_activity_B) | ||
| button.setOnClickListener { | ||
| val intent = Intent(this, MainActivityB::class.java).apply { | ||
| flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK |
There was a problem hiding this comment.
Неверный режим запуска активити. Новый таск не создается. Почитайте документацию на FLAG_ACTIVITY_NEW_TASK
No description provided.