android - Text viewed as HTML -



android - Text viewed as HTML -

hey update previous question [android] showing edittext text in webview

i got webview see text within edit text field displaying text coding im using

case r.id.preview: intent j = new intent(this, preview.class); j.putextra(com.afajje.htmlzero.preview.url, myedittext.gettext().tostring()); startactivity(j); } homecoming false;}

want im trying have view edit text, text html

for illustration if set in edittext field

<html> <head> </head> <body> <p>this preview</p> </body> </html>

in web view itll just "this preview"

here ya go, working demo:

package com.stackexchange.test; import android.app.activity; import android.os.bundle; import android.text.html; import android.text.spanned; import android.widget.edittext; public class home extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); edittext box = (edittext) findviewbyid(r.id.edittext); string htmltext = "<b>this bold. </ b> , <i> italic </ i>." ; spanned text = html.fromhtml( htmltext ); box.settext( text ); } }

you should see (except i've edited text in app):

android

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -