You can create your own dialog box in an Android application to display an error message. Below is the code for this:
AlertDialog alertDialog = new AlertDialog.Builder(LoginActivity.this).create();
alertDialog.setTitle("Error");
alertDialog.setMessage("Not A User");
alertDialog.setIcon(R.drawable.inputerror);
alertDialog.setButton("OK",new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
Toast.makeText(getApplicationContext(),"Not A Valid User", Toast.LENGTH_SHORT).show();
}
});
alertDialog.show();
return;
source
share