General questions

Restore String on Widget

Hi Support,

I have a question, when a recognition session ends It returns the widget in which I could easily extract the result in string by using widget.getResultAsText() but I want to restore this result on widget In edit mode, When I come back on this screen. Need help in this case.

Regards,


Objet : Facing Poblem In Converting byte[] to string (Ignore the previous Email)

I am facing a problem in converting byte array byte[] to string and vice versa. Following are the steps which I am following.

1) @Override
public void onRecognitionEnd(MathWidgetApi widget) {
if (BuildConfig.DEBUG) {
byte[] widgetData = widget.serialize();
try {
String widgetdata = new String(widgetData); // 1st try
// String widgetdata = Arrays.toString(widgetData); //2nd try
} catch (Exception e) {
e.printStackTrace();
}
}
}

When I am converting from string to byte[] and reloading the equation on widget . Its not working.
byte[] bytes = widgetdata.getBytes();
mWidget.unserialize(bytes);
Equation is not loading . Plz help me in this regard. I am stuck on this point since 1 day.

Thanks,
Ahsan

In order to better help you, could you please let us know which widget and platform do you use?
Best regards

Login or Signup to post a comment