Advice needed with edit text fields
<p>Hey guys I have an <code>Activity</code> with some <code>EditText</code> fields. </p>

<p>The user needs to fill up all the text fields before pressing the save <code>Button</code>.</p>

<p>Here is what I thought would work. I checked the texts entered in the <code>EditText</code> fields, if the text is not null, then the respective data is saved in 
the data base, but if the text is null, a <code>Toast</code> is displayed displaying a message to re enter the text. here's the code:</p>

<pre><code>          account_Number.setText(null);
          customer_Number.setText(null);
          account_Holder.setText(null);
          bank_Name.setText(null);
          branch_Name.setText(null);
          branch_Address.setText(null);
          Ifsc.setText(null);
          Micr.setText(null);
          current_Balance.setText(null);

    AddAccount = (Button) findViewById(R.id.addAccount);
    AddAccount.setOnClickListener(this);

}

// only after all the fields have been filled, should the message data added
// successfully be displayed.
@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
    case R.id.addAccount:// try making the user enter in all the fields
        boolean work = true;
        if (account_Number.getText() != null
                &amp;&amp; customer_Number.getText() != null
                &amp;&amp; account_Holder.getText() != null
                &amp;&amp; bank_Name.getText() != null
                &amp;&amp; branch_Name.getText() != null
                &amp;&amp; branch_Address.getText() != null
                &amp;&amp; Ifsc.getText() != null &amp;&amp; Micr.getText() != null
                &amp;&amp; current_Balance.getText() != null) {
            try {
                String accountNumber = account_Number.getText().toString();

                String customerNumber = customer_Number.getText()
                        .toString();

                String accountHolder = account_Holder.getText().toString();

                String bankName = bank_Name.getText().toString();
                String branchName = branch_Name.getText().toString();
                String branchAddress = branch_Address.getText().toString();

                String ifsc = Ifsc.getText().toString();
                String micr = Micr.getText().toString();
                String currentBalance = current_Balance.getText()
                        .toString();

                DatabaseClass entry = new DatabaseClass(AddnewAccount.this);
                entry.open();
                entry.createEntry(accountNumber, customerNumber,
                        accountHolder, bankName, branchName, branchAddress,
                        ifsc, micr, currentBalance);
            } catch (Exception e) {

                work = false;
                Dialog message = new Dialog(this);
                message.setTitle("Error");
                String error = e.toString();
                TextView tv = new TextView(this);
                tv.setText(error);
                message.setContentView(tv);

                message.show();

            } finally {
                Toast message = Toast.makeText(AddnewAccount.this,
                        "Data Added Successfully", Toast.LENGTH_SHORT);
                message.show();
                Intent goBackHome = new Intent(AddnewAccount.this,
                        AccountManagerActivity.class);
                startActivity(goBackHome);
                finish();

            }
        } else {
            Toast message = Toast.makeText(AddnewAccount.this, // not getting executed
                    "Please Fill All The Fields", Toast.LENGTH_LONG);
            message.show();
            Intent refill = new Intent(AddnewAccount.this,
                    AddnewAccount.class);
            startActivity(refill);
            finish();

        }
        break;
    }

}
</code></pre>
