如何访问与该适配器链接的活动中的适配器持有器。

发布于 2025-01-31 00:42:00 字数 260 浏览 5 评论 0原文

我有一个名为admin的活动和主动脉,其中我使用RecyClerview从数据库中充气并加载数据。

在行政命令上,我有一个SwitchCompat。

我想做的是,我切换到“ on”位置时,学生可以单击Main Activitive页面上的任何项目。但是当它在“关闭”位置上时,itemClick关闭了。

但是,这种行政部门与适配器的适配器无关。 有什么办法可以访问适配器的持有器。项目view而无需加载管理活动上的项目?

任何帮助将不胜感激!! 谢谢

I have an activity named Admin and MainActivity of which I have inflate the adapter and loading data from the database using recyclerView.

On the adminActivity, I have a SwitchCompat.

What I want to do is that, whan I Switch to the "ON" position, students can click on any item on the MainActivity page.. But when its on the "OFF" position, itemclick is off.

But this AdminActivity isnt linked to the adapter rendering the items on the MainActivity..
Is there any way I can access the adapter's holder.itemview without loading the items on the Admin Activity ??

Any help will be much appreciated !!
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪落纷纷 2025-02-07 00:42:00

您可以使用SharedPreference来保存ON/OFF状态。在单击项目时,您可以检查状态是否为ON/OFF。根据此,您可以添加逻辑。

You can use SharedPreference to save the ON/OFF state. While clicking on the items you can check whether the state is ON/OFF. Depending upon that you can add your logic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文