How to differentiate From Which Activity the current intent comes

前端 未结 3 843
情深已故
情深已故 2021-01-25 15:35

Form Activity Login I call

Intent intent=new Intent(LogIn.this,BRInfoActivity.class);

From Activity BrActivityList I Call

Inten         


        
3条回答
  •  滥情空心
    2021-01-25 16:01

    Form Activity Login call this--

    Intent intent=new Intent(LogIn.this,BRInfoActivity.class);
    intent.putExtra("call_from","ActivityClass");
    

    From Activity BrActivityList Call--

    Intent intent=new Intent(BRActiviList.this, BRInfoActivity.class);
    intent.putExtra("call_from", "BRActivity");
    

    Now, when you get the intent, compare the "call_from" string in an if-else block! That's it!

提交回复
热议问题