protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); App._file = null; App._dir = null; App.bitmap = null; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Signup); _txtUserName = FindViewById <EditText> (Resource.Id.txtName); _txtEmail = FindViewById <EditText> (Resource.Id.txtEmail); _txtPassword = FindViewById <EditText> (Resource.Id.txtPassword); _txtConfirmPwd = FindViewById <EditText> (Resource.Id.txtConfirmPassword); String userName = Intent.GetStringExtra("userName"); if (String.IsNullOrEmpty(userName) == false) { _txtUserName.Text = userName; } _imageView = FindViewById <ImageView> (Resource.Id.imgPhoto); // Get our button from the layout resource, // and attach an event to it Button butRegister = FindViewById <Button> (Resource.Id.btnRegister); if (butRegister != null) { butRegister.Click += delegate { if (String.IsNullOrEmpty(_txtUserName.Text) == true) { Toast.MakeText(this, "Please input user name", ToastLength.Short).Show(); return; } if (String.IsNullOrEmpty(_txtEmail.Text) == true) { Toast.MakeText(this, "Please input email", ToastLength.Short).Show(); return; } if (String.IsNullOrEmpty(_txtPassword.Text) == true || String.IsNullOrEmpty(_txtConfirmPwd.Text) == true) { Toast.MakeText(this, "Please input password", ToastLength.Short).Show(); return; } if (_txtPassword.Text.Equals(_txtConfirmPwd.Text) == false) { Toast.MakeText(this, "Passwords are not the same. Please check again", ToastLength.Short).Show(); return; } _progDlg = ProgressDialog.Show(this, "", GetString(Resource.String.msg_wait), true, true); _progDlg.CancelEvent += (object sender, EventArgs e) => { }; if (App._file == null) { WebService.doRegisterUser(this, _txtUserName.Text, _txtEmail.Text, _txtPassword.Text, ""); } else { WebService.doUploadPhoto(this, App._file.Path); } }; } Button btnCancel = FindViewById <Button> (Resource.Id.btnCancel); if (btnCancel != null) { btnCancel.Click += delegate { Finish(); //FinishActivity(-1); }; } CreateDirectoryForPictures(); RelativeLayout rlTakePHoto = FindViewById <RelativeLayout>(Resource.Id.rlImagePhoto); rlTakePHoto.Click += delegate { Intent intent = new Intent(MediaStore.ActionImageCapture); App._file = new File(App._dir, String.Format("myPhoto_{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Uri.FromFile(App._file)); StartActivityForResult(intent, PickImageId); }; Global.HideKeyboard(this, InputMethodService); }