Answer the question
In order to leave comments, you need to log in
Why isn't the OnActivityResult method running?
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Main);
imageView = FindViewById<ImageView>(Resource.Id.imageView);
Intent intent = new Intent(MediaStore.ActionImageCapture);
App._file = new File("img", String.Format("myPhoto_{0}.jpg", DateTime.Now));
intent.PutExtra(MediaStore.ExtraOutput, Uri.FromFile(App._file));
StartActivityForResult(intent, 0);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
Uri contentUri = Uri.FromFile(App._file);
mediaScanIntent.SetData(contentUri);
SendBroadcast(mediaScanIntent);
App.bitmap = BitmapFactory.DecodeFile(App._file.Path);
if (App.bitmap != null)
{
imageView.SetImageBitmap(App.bitmap);
App.bitmap = null;
}
GC.Collect();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question