0
I have an Activity with a text about terms of use. It can be called through a menu and opened directly. So for this reason I have put in the manifest this Activity in parentActivityName so that when it is opened appears the arrow to return to the main screen.
Stayed that way:
<activity
android:name=".ActivityTerms"
android:label="Declarações Legais"
android:parentActivityName=".ActivityMain" />
Now after weeks developing, I realized that I need to call this same Activity on a button on the registration screen, and some other places of the application.
Then it ceases to be related only to the main screen, and becomes several other screens.
Until then I did some tests, and it worked normally, even if the arrow appears and the screen is not related to her, when clicking it is returning to the previous screen normally.
Now I ask... can I have future problems using this way? Will I not have problems in other types of devices?
Pq on my phone and emulator works normal, but my fear is when the application is launched, start giving some error because of this. I take some risk?
I can’t think of any problem. What kind of problem are you referring to?
– ramaral
@ramaral, I don’t know, suddenly some bug, or conflict on some device that takes the manifest to the letter. What actually should neh. Since we put from whom Activity is Parent, and the return button is based on this, it’s even strange that he accepts that I call Activity from somewhere else and even then the back button works normally. At least in the devices I have tested so far ta everything ok.
– Fernando VR
The arrow in the upper left corner (in Toolbar) returns to
parentActivityName
. The key back returns to the Activity that called it.– ramaral
@ramaral Then something is going wrong in my app, because for both the arrow and the back key, it’s going back to Activity q called even though I set the parentActivityName in the manifest. The only difference that is happening, is that when I go through the back key it just closes, and comes back without recreating, but when I go through the arrow, it closes, but recreates the previous Activity again.
– Fernando VR
Make sure you’re doing everything as described in Adding an Up Action. Pay attention to the note that refers to use on devices with Android less than 4.1.
– ramaral
So I gave a read there, and for now this everything is fine according to the documentation. I think I will not have any future problem. I’ll take it off then. Thank you very much for the @ramaral replies
– Fernando VR