Alert Dialogue on launch example in android
package com.textview;
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.text.Html;
public class TextViewActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlertDialog.Builder ab=new AlertDialog.Builder(TextViewActivity.this);
ab.setMessage(Html.fromHtml("<b><font color=#ff0000> Html View " +"</font></b><br>Androidpeople.com"));
ab.setPositiveButton("ok", null);
ab.show();
}
}
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
No comments:
Post a Comment