package com.exercise.AndroidHtmlEncode;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;
public class AndroidHtmlEncodeActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView textSrc = (TextView)findViewById(R.id.src);
TextView textDest = (TextView)findViewById(R.id.dest);
String src = "example: <activity>";
String dest = TextUtils.htmlEncode(src);
textSrc.setText(src);
textDest.setText(dest);
}
}
Saturday, 13 August 2011
Html-encode string using TextUtils.htmlEncode()
In order to convert string to html format, we can use htmlEncode() method of TextUtils class.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment