[英]Is it possible to pass intent by intent?
我想通过这样的事情,可以吗? 或如何以其他方式做到这一点?
如果您不知道,请弹出线程。
感谢您的时间。
我要实现的目标:
我想根据MyClassAdapter中的列表更改按钮的可见性。 因为在一个活动中我出现了一些添加东西的按钮,并准备去下一个活动,例如从列表中删除一些东西,返回上一个活动,现在按钮可见,所以我想使其不可见。
这是我的代码:
Intent i = new Intent(getContext(),MyClassAdapter.class);
i.putExtras(button_submit.setVisibility(View.VISIBLE));
这是我的错误:
The method putExtras(Intent) in the type Intent is not applicable for the arguments (void)
final String VISIBILITY_EXTRA = "viewVisibility";
通过一个整数,
Intent i = new Intent(getContext(),MyClassAdapter.class);
i.putExtra(VISIBILITY_EXTRA,View.VISIBLE);
收到时
int visibility = intent.getIntExtra(VISIBILITY_EXTRA);
如果您尝试传递视图,则这是一种不好的方法。 请改用片段。
我不确定您要达到的目标,但是您不能做到:
i.putExtras(button_submit.setVisibility(View.VISIBLE));
方法View#setVisibility
的返回类型为void
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.