Wait an activity to finish

Hi, I am making an App to take pictures, I have a method in the Android section using dependency service. This method start an activity for taking the picture and return the path to the picture so I can use it in my shared code. My problem is that the method returns the path before the activity ends. How can I await for the end?

        public string takePicture()
        {
            var intent = new Intent(MediaStore.ActionImageCapture);
            intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(file));

            Forms.Context.StartActivity(Intent.CreateChooser(intent, "Take picture"));

           return  file.Path;
        }

Posts

Sign In or Register to comment.