Search code examples
androidsdkandroid-edittextsamsung-mobilesamsung-mobile-sdk

Convert SpenObjectBase to String for EditText


I am working on Samsung Mobile SDK and using it's TextRecognition feature for recognition of text written on SpenSurfaceView. I have done this using example provided by Samsung. After conversion I receive data as object SpenObjectBase class.
Now my question is can we convert this SpenObjectBase object as String so that I can show the converted text in EditText ?

Thanks in advance.


Solution

  • You could try casting it to SpenObjectText and then extracting CharSequence with getText() method:

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