関数が呼び出されたときに新しいスレッドを開始しようとしていますが、それは私に与えます
Android: java.lang.IllegalMonitorStateException: object not locked by thread before wait()
これが私のコードです
public class webcam_audio_record_V1_4 extends webcam_audio_record implements Command {
private static final int TLV_EXTENSIONS = 20000;
private static final int TLV_TYPE_AUDIO_DURATION = TLVPacket.TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 1);
private static final int TLV_TYPE_AUDIO_DATA = TLVPacket.TLV_META_TYPE_RAW | (TLV_EXTENSIONS + 2);
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
int duration = request.getIntValue(TLV_TYPE_AUDIO_DURATION);
Thread thread = new Thread(new Runnable() { public void run() { record(); } });
thread.start();
try { wait(duration * 1000); } catch (InterruptedException e) {}
try { thread.join(); } catch (InterruptedException e) {}
play();
return ERROR_SUCCESS;
}
public void record() {
}
public void play() {
}
どうすればAndroidでスレッドを正常に開始できますか