Switching between activities in android?

前端 未结 7 556
有刺的猬
有刺的猬 2020-12-18 10:22

In my android application, I have following requirement.

Activity A --> Activity B(Go to A Option) --> Activity C(Go To A Option,Go To B Option)

<
相关标签:
7条回答
  • 2020-12-18 11:18

    A reliable solution is ..

    You start Activities Using StartActivityForResult()

    And based on conditions You set ResultCodes in Activities.. Something like this..

    GO_TO_ACT_A=1; GO_TO_ACT_B=2;

    And in all Activies onActivityResultMethod check the result code..

    if(resultCode==GO_TO_ACT_A){
        finish(); //Assuming curently you are in Activity C and wanna go to Activity A
    }
    
    0 讨论(0)
提交回复
热议问题