问题描述
我有一个import audioop
import wave
from array import array
from math import sin,pi
bytes_per_sample = 2
duration = 3. # seconds
sample_rate = 16000. # Hz
frequency = 440. # Hz
max_amplitude = 2**(bytes_per_sample * 8 - 1) - 1
amp = max_amplitude * 0.8
time = [i / sample_rate for i in range(int(sample_rate * duration))]
samples = [int(round(amp * sin(2 * pi * frequency * t))) for t in time]
fragment_mono = array('h',samples).tobytes()
fragment_stereo = audioop.tostereo(fragment_mono,bytes_per_sample,1,1)
with wave.open('sine_440hz_stereo.wav','wb') as wav:
wav.setnchannels(2) # stereo
wav.setsampwidth(bytes_per_sample)
wav.setframerate(sample_rate)
wav.writeframes(fragment_stereo)
# read wave file again
with wave.open('sine_440hz_stereo.wav','rb') as wav:
fragment = wav.readframes(wav.getnframes())
# test whether written fragment and read fragment are same
assert fragment == fragment_stereo
,其中包含用户列表。
当用户被点击时,RecyclerView
会与另一个Fragment
更改为第二个Fragment
(包含来自第一个RecyclerView
的用户喜欢的歌曲)。这两个列表都来自同一SQLite数据库中的同一表。
我要解决的问题是我希望第二个RecyclerView
列出仅与在第一个RecyclerView
中单击的用户名相关的歌曲。所以我想用RecyclerView
过滤数据库行。我不知道如何将userName
传递给DAO。我需要有关如何执行此操作的指导。我知道我必须传递一个来自userName
的自变量,但这是我遇到的问题。我不相信我应该使用导航组件传递参数,因为那仅在片段之间起作用?不确定如何继续,我在kotlin中找不到任何在线教程。任何方向都会有所帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)