title: Access EditText.getText().toString() inside some other class
body: <p>I have a custom dialog inside</p>
  
  <pre><code>public class NewPartnerDialog extends Dialog implements OnClickListener
  </code></pre>
  
  <p>And I call it from other class (activity)</p>
  
  <pre><code>private void showCustomDialog() {
      NewPartnerDialog customDialog = new NewPartnerDialog(this);
      customDialog.show();
  }
  </code></pre>
  
  <p>And it works (it does show), but I have a little problem. In it I have 3 EditText fields. How can I retreieve those typed values and pass them into some other class construtor. Here is the code.</p>
  
  <pre><code>public class NewPartnerDialog extends Dialog implements OnClickListener {
  public NewPartnerDialog(Context context) {
      super(context);
      mainContext = context;
  
      setContentView(R.layout.dialog_new_partner);
      setTitle("Dialog");
  
      finish = (Button) findViewById(R.id.finish);
      cancel = (Button) findViewById(R.id.finish);
      finish.setOnClickListener(this);
      cancel.setOnClickListener(this);
  
      name = (EditText) findViewById(R.id.name);
      address = (EditText) findViewById(R.id.address);
      city = (EditText) findViewById(R.id.city);
  }
  
  @Override
  public void onClick(View v) {       
      if (v == finish) {
          Partner.addNewPartner(mainContext, name.getText().toString(), address.getText().toString(), city.getText().toString());
      } else if (v == cancel) {
          dismiss();
      }
  }
  
  private static EditText name;
  private static EditText address;
  private static EditText city;
  private static Context mainContext;
  private Button finish;
  private Button cancel;
  </code></pre>
  
  <p>}</p>
  
  <p>The error is obivusly here</p>
  
  <pre><code>if (v == finish) {
          Partner.addNewPartner(mainContext, name.getText().toString(), address.getText().toString(), city.getText().toString());
      }
  </code></pre>
  
  <p>because it says NullPointerException but how to fix it?</p>