Code example for DialogFragment

Methods: dismiss, getActivity, isValidEmail, isValidPhone

0
	public void onClick(View arg0) {
		// TODO Auto-generated method stub 
		String email = emailEditText.getText().toString();
		String phoneNumber = phoneNumberEditText.getText().toString();
		 
		if(!isValidEmail(email)){
			emailEditText.setError("Invalid Email");
			return; 
		} 
		 
		if(!isValidPhone(phoneNumber)){
			phoneNumberEditText.setError("Invalid Phone Number");
			return; 
		} 
		 
		MainActivity activity = (MainActivity) getActivity();
		 
		UserData userData = new UserData();
		userData.setEmail(email);
		userData.setPhonenumber(phoneNumber);
		userData.setTermsAccepted(true);
		 
		activity.doListenerTask(userData);
		this.dismiss();
	} 
 
	public final static boolean isValidEmail(CharSequence target) {
	    if (target == null) {
	        return false;