所以我在适配器中有以下代码:
@Override
public boolean isEnabled(int position)
{
GeneralItem item = super.getItem(position);
boolean retVal = true;
if (item != null)
{
if (currSection != some_condition)
retVal = !(item.shouldBeDisabled());
}
return retVal;
}
public boolean areAllItemsEnabled()
{
return false;
}
Run Code Online (Sandbox Code Playgroud)
这里的问题是:如果我在初始绑定期间禁用了我的项目,现在我在屏幕上引发事件并且无论如何都需要启用它们.在执行该操作后,我是否再次重新绑定它?
例如:
onCreate{
// create and bind to adapter
// this will disable items at certain positions
}
onSomeClick{
I need the same listview with same items available for click no matter what the conditions of positions are, so I need them …Run Code Online (Sandbox Code Playgroud) 我是在 IOS 中使用声音和 AVAudioEngine 的初学者,我正在开发一个应用程序,将音频样本捕获为缓冲区并对其进行分析。此外,采样率必须为 8000 kHz,也必须编码为 PCM16Bit,但 AVAudioEngine 中的默认 inputNode 为 44.1 kHz。
在 Android 中,过程非常简单:
AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
8000, AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);
Run Code Online (Sandbox Code Playgroud)
然后启动缓冲区的读取功能。我搜索了很多,但没有找到任何类似的例子。相反,我遇到的所有示例都以默认节点的采样率(44.1 kHz)捕获样本,例如:
let input = audioEngine.inputNode
let inputFormat = input.inputFormat(forBus: 0)
input.installTap(onBus: 0, bufferSize: 640, format: inputFormat) { (buffer, time) -> Void in
print(inputFormat)
if let channel1Buffer = buffer.floatChannelData?[0] {
for i in 0...Int(buffer.frameLength-1) {
print(channel1Buffer[i])
}
}
}
try! audioEngine.start()
Run Code Online (Sandbox Code Playgroud)
所以我想使用 AVAudioEngine 以 8000 kHz 采样率和 PCM16Bit 编码捕获音频样本。
*编辑: 我找到了将输入转换为 8 kHz 的解决方案: …
我想知道如何在MapView中随机地固定15个注释
let latitude: CLLocationDegrees = 33.606800
let longitude: CLLocationDegrees = -111.845360
let location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)
//map annotation
let annotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = "Taliesin West"
annotation.subtitle = "Design"
map.addAnnotation(annotation)
Run Code Online (Sandbox Code Playgroud)