How to alert when user submits with empty fields
<p>I want to add an alert in my code, so that when the user clicks the button without filling fields, an error message occurs. Please suggest some measures.</p>

<p>This is my code:</p>

<pre><code>    Button button1 = (Button) findViewById(R.id.widget45);
    button1.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

          tv= name.getText().toString();
           tv1 = pass.getText().toString();
           x.setText(tv);
           y.setText(tv1);
       }
    });


}
</code></pre>

<p>}</p>
