Creating Android Activity

Asked 1 years ago, Updated 1 years ago, 61 views

Hello. I'm posting a question while I'm studying Android.

If Activity A, B exists and when it first started, it made Activity A onCreate.

If you press the button in A, I want to start the activity of B. However, I want to keep screen A continuously so that B's activity is only the beginning and the screen is not switched.

The reason is that there is a Google map in activity B, and I want to mark the location in activity B.

Is there anything that only creates activities and does not switch? If not, what is the solution?

actvitiy android

2022-09-22 19:16

1 Answers

I was able to create the type of screen I wanted by the way @pistolcaffe left a comment. It's been a while, but I hope there's someone who can help.

Fragment allows you to place multiple screens in one activity.

If you compare the difference with Activity,

Activity must be displayed on the screen to become onCreate.

Fragment is onCreate even if the screen is not displayed.

Simply put, Fragment is what you put on Activity.

In other words, even if the fragment is not visible on the screen, just attach it to Activity,

You can perform onCreate.

(When there are multiple Fragments, even if one Fragment occupies the entire screen, the other Fragment performs an onCreate.)

틀린 Tell me if there's anything wrong!


2022-09-22 19:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.