title: Android firebase create account
body: <p>I don't know how to write the if statement if I want to check if the account had been create or not.
  Here is my code.
  I don't know how to judge if it is existed or not.
  Please help me to solve it.  </p>
  
  <p><code>public class MainActivity extends AppCompatActivity {</code></p>
  
  <pre><code>DatabaseReference mRef = FirebaseDatabase.getInstance().getReference();
  private Button Go;
  private EditText account;
  private EditText password;
  private EditText pass2;
  private FirebaseAuthException mAuth;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      account = (EditText) findViewById(R.id.editText);
      password = (EditText) findViewById(R.id.editText2);
      pass2 = (EditText) findViewById(R.id.editText3);
      Go = (Button) findViewById(R.id.button2);
      Go.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              startSignin();
              Intent intent = new Intent();
              intent.setClass(MainActivity.this,MemberCenter.class);
              startActivity(intent);
          }
      });
  }
  
      private void startSignin(){
          String value = account.getText().toString();
          String mvalue = password.getText().toString();
          String two = pass2.getText().toString();
  
          if(mvalue.equals("")||value.equals(""))
          {
              Toast.makeText(getApplicationContext(),"cant be empty!",Toast.LENGTH_LONG).show();
          }
          else if(!mvalue.equals(two))
          {
              Toast.makeText(getApplicationContext(),"password are different",Toast.LENGTH_LONG).show();
          }
  </code></pre>
  
  <p>I don't know how to type this code.</p>
  
  <pre><code>        else if(mRef==null)
          {
              Toast.makeText(getApplicationContext(),"account is existed",Toast.LENGTH_LONG).show();
          }
          else{
              mRef.child("Account").child(value).setValue(mvalue);
          }
  
  }
  </code></pre>
  
  <p>}</p>