Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Wait an activity to finish

$
0
0

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;
        }

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>