允许从不同的活动按钮的android [英] Enable a button android from a different Activity
问题描述
在我的code我在活动中被禁用按钮A
我可以启用的活动'A'
从活动'B'
?
In my code I have a disabled button in the activity 'A'
Can I enable that button on the activity 'A'
from an activity 'B'
?
感谢。
推荐答案
通常情况下,你不能。
如果您是从b活动调用活动A,那么你可以通过是否启用通过意向的按钮的信息。
If you are invoking activity A from activity B, then you can pass information on whether to enable the button via the intent.
如果A调用B和你需要做一些事情回来与 startActivityForResult
根据B中用户的操作,那么你可以调用B和从B分别发送结果回至A;那么基于什么B已传回的 onActivityResult
的活动为您的,您可以启用/禁用按钮。
If A invoked B and you need to do something back in A based on user's actions in B, then you can invoke B with startActivityForResult
and send the result back from B to A; then in onActivityResult
of your activity A you can enable/disable the button based on what B has passed back.
这篇关于允许从不同的活动按钮的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!