package com.alt; // package name
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.Toast;
public class alertBox extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlertDialog.Builder altDialog= new AlertDialog.Builder(this);
altDialog.setMessage("Alert Dialog Message"); // here add your message
altDialog.setNeutralButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "Ok button Clicked ", Toast.LENGTH_LONG).show();
}
});
altDialog.show();
}
}
After Ok button Press it will display below screen.
Sameeraa4ever
How to Set background on Alert box button.
ReplyDelete