将SpenObjectBase转换为EditText的String

时间:2014-01-03 08:09:24

标签: android sdk android-edittext samsung-mobile samsung-mobile-sdk

我正在使用Samsung Mobile SDK并使用它的TextRecognition功能来识别在SpenSurfaceView上写的文本。我使用三星提供的示例完成了此操作。转换后,我接收数据作为对象SpenObjectBase类 现在我的问题是我们可以将这个SpenObjectBase对象转换为String,以便我可以在EditText中显示已转换的文本吗?

提前致谢。

1 个答案:

答案 0 :(得分:1)

您可以尝试将其投放到SpenObjectText,然后使用CharSequence方法提取getText()

SpenObjectBase base = //.. your object containing text data
if (base instanceof SpenObjectText) {
    SpenObjectText text = (SpenObjectText) base;
    mEditText.setText(text.getText());
}