【发布时间】:2018-12-14 09:56:29
【问题描述】:
我在一个活动中有两个片段。 RecordFragment 录制音频,RecordingsFragment 显示所有录制的音频。 我的问题是如何在 RecordFragment 中单击停止按钮后刷新 RecordingsFragment 的 RecyclerView。
这是适配器的代码。 Utils.getListOfNames() 从存储中检索文件列表。
mRecyclerView = rootView.findViewById(R.id.recyclerView);
mAdapter = new RecordingsListAdapter(Utils.getListOfNames(), getContext());
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
这是stopButton的onClick
Toast.makeText(getContext(), "Stop clicked ", Toast.LENGTH_SHORT).show();
mediaRecorder.stop();
startButton.setVisibility(View.VISIBLE);
stopButton.setVisibility(View.GONE);
【问题讨论】:
-
使用接口进行回调
-
到目前为止你写了什么?我希望你没有使用静态列表
-
尝试改进您的问题,检查How to Ask。添加您正在使用的代码或更多详细信息以获得更精确的解决方案。
标签: android