android - Saving an Editable object to file -


how can save editable object medittext.gettext(); file? have tried following code , works @ end ioexception , ioexception.getlocalizedmessage(); , ioexception.getmessage(); both displays following string.

e/error:(5223): android.text.spannablestringbuilder 

here code tried with:

      try {                                                                                                    spannablestringbuilder ssb = new spannablestringbuilder(mmainedittext.gettext());        //create file object user entered file name...       file outputfile = new file(getdocstoragefolder(),               muserenterfilename               + ".msd");        log.e("path:", "" + outputfile.getabsolutepath());           toast.maketext(mainactivity.this, "" + outputfile.getabsolutepath(), toast.length_long).show();    fileoutputstream fos = new fileoutputstream(outputfile); //create fileoutputstream here                              objectoutputstream oos = new objectoutputstream(fos);       oos.writeobject(ssb);       oos.close();       oos.flush();       fos.close();                                                      toast.maketext(mainactivity.this, "success!", toast.length_long).show();   } catch (ioexception e) {       e.printstacktrace();             log.e("error: ", e.getmessage());       log.e("error: ", e.getlocalizedmessage());       toast.maketext(mainactivity.this, "error occured while "               + "attempting create document file!", toast.length_long).show();   } 

you cannot directly save editable, or spannablestringbuilder, file.

you welcome convert contents of spanned can write file. not aware of covers possible spans, in large part because can invent own.

html.tohtml() in android sdk take subset of spans , generate html them.

also, my cwac-richedit library contains a spannedxhtmlgenerator converts different subset of spans xhtml, designed read in using spannablestringgenerator same library.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -