There are two Activities: on the first there is a Button and TextView , on the second there is a Button and EditText . Being on the first Activity the user presses the button and the second Activity opens:

 StartActivity(typeof(ListAddItemActivity)); 

On ListAddItemActivity user enters the word in EditText and presses the button, thereby closing the Activity:

 MyListActivity.Str = _str; // Статическое свойство 1-ой activity Finish(); 

It is necessary that the first displayed the word in the TextView .

Where to put myTextView.Text = Str; so that Activity understands it when moving to it from another? It is necessary to somehow correctly use onPause() and onResume() , but I just can not figure out exactly how to implement it.

  • 3
    Specifically, to pass any result from Activity2 back to it, there are methods startActivityForResult() and onActivityResult() in Activity1 . How to implement them in Xamarin, I do not know. But Google knows for sure. - Vladyslav Matviienko

1 answer 1

Try OnActivityResult (this method should be in your first Activity ):

 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (resultCode == Result.Ok) { var textViewFromFirstActivity = FindViewById<TextView> (Resource.Id.textViewFromFirstActivity); textViewFromFirstActivity.Text = data.GetStringExtra("msg"); } }