如何区分哪个活动当前的意图来 [英] How to differentiate From Which Activity the current intent comes

查看:90
本文介绍了如何区分哪个活动当前的意图来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

形式的活动登录我称之为

Form Activity Login I call

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

从活动BrActivityList我称之为

From Activity BrActivityList I Call

Intent intent=new Intent(BRActiviList.this, BRInfoActivity.class);
intent.putExtra("BRinfo", objBR);

和现在BRInfoActivityList

And Now in BRInfoActivityList

Intent i = getIntent();
BrInfoEN objBR=(BrInfoEN)i.getSerializableExtra("BRinfo");

现在我想如果(意向== BrActivityList)最后两个以上的行执行,否则不not.How办呢?

Now i want if(intent==BrActivityList)The last two above line execute otherwise does not.How to do it?

推荐答案

形式的活动登录调用这个 -

Form Activity Login call this--

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

从活动BrActivityList呼叫 -

From Activity BrActivityList Call--

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

现在,当你的意图,比较call_from字符串中的if-else块!这就是它!

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

这篇关于如何区分哪个活动当前的意图来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆