Wednesday, September 28, 2011

Android HTML View

Example for Android HTML View :-

public class ExampleApp extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        AlertDialog.Builder ab=new AlertDialog.Builder(ExampleApp.this);
        ab.setMessage(Html.fromHtml(
            "<b><font color=#ff0000> Html View " +"</font></b><br>Androidpeople.com"));
        ab.setPositiveButton("ok", null);
        ab.show();
    }
}
Here i used ‘<b>’ tag for Bold & ‘<br>’ tag for new line in a alert dialog box.

we can use this code for textview text, button text ,etc…
The output will looks like

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.