Search code examples
androidback-stackandroid-navigationonbackpressed

Customize back navigation


First of all I read this article but is kind of complicated for me . All I need is to go to an activity I want (navigate if exist in back stack or start it with Intent if it's not ) in onBackPressed() override . should I manage back stack or something else ? if yes how ? and if no what is a simple way for that ?

P.S : I dont use ActionBar


Solution

  • SOLVED: as mentioned in this answer and according to comments , if we want to just bring an (existing )Activity to front , setting Intent flag to :

        Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
    

    wont create new instance of Activity we want and just bring it front . this would be useful if we have multiple activities on top of the one .