我MediaPipe
在 Android 中使用从图表中获取输出,并将该输出设置为EditText
文本。以下是代码:
editText.setText("hello world".toString());
processor.addPacketCallback(
OUTPUT_STREAM_NAME,
(packet) -> {
String output = PacketGetter.getString(packet);
editText.setText("hello world 1".toString());
//editText.setText(output.toString());
Log.d(TAG,"[TS:" + packet.getTimestamp() + " : " + ouput);
});
回调外部工作正常,但回调内部setText()
从未设置,每当我尝试选择EditText
以下异常时:
java.lang.IndexOutOfBoundsException: setSpan (-1 ... -1) starts before 0