【发布时间】:2017-08-30 09:20:52
【问题描述】:
我在使用界面时遇到问题。在我的片段中,我制作了接口,我想在类(带适配器)中使用它,类不是活动。类从片段实现接口,我尝试使用类似的意图:
Intent intent = new Intent(getContext(), Adapter.class);
intent.putExtra("interface", inter);
startActivity(intent);
和
Intent intent = getIntent();
removelist inter = (removelist) intent.getSerializableExtra("interface");
我应该在适配器的哪个位置包含这个,这是一个正确的解决方案吗?
【问题讨论】:
-
从您的代码看来,您正在尝试打开名为 Adapter 的活动(您将其称为“不是活动”)那么您究竟想通过接口实现什么?
-
什么是Adapter.class,是你的活动吗?问题一点都不清楚....
-
你打算实现什么目标?
-
我想制作一个可以在adapter.class中工作的界面,点击片段中的菜单
标签: android android-fragments interface