Eureka!

After having gone with the Nuclear Option, and removing ALL other code in
the activity not related to a simple button launching the camera, I finally
found the source of my woes.

1 option in the Activity tags, NoHistory = true - SET THIS TO FALSE if you
want your camera - or anything - to return results to your Activity!

Yeah, I feel pretty dumb now...:-\

Thanks,
Brian Matz
Software Architect
Mobile Epiphany


On Fri, Oct 14, 2011 at 9:30 AM, Brian Matz <[email protected]>wrote:

> Outside my project, in a new, empty Android app, both your code and mine
> works correctly with the camera, and OnActivityResult IS called.
>
> This leads me to believe that the problem lies somewhere else in my code.
>
> You see, my application only has 1 activity, the rest of the 'screens' are
> created in code and applied to that activity's main layout.
>
> In the code in question, I'm calling into the Activity's public method
> StartCamera() that I posted earlier, making the presumable assumption that
> it should function as if it were all invoked by that Activity directly.
>
> In fact, I've taken it one step further, and just called the code in
> question directly from the Activity itself on startup, but the same failed
> results appear there too.
>
> Thoughts ?
>
>
> Thanks,
> Brian Matz
> Software Architect
> Mobile Epiphany
>
>
> On Fri, Oct 14, 2011 at 9:16 AM, efontana <[email protected]> wrote:
>
>> This code works for me, and OnActivityResult is called:
>>
>>  void useCamera()
>>    {
>>      Intent intent = new
>> Intent(Android.Provider.MediaStore.ActionImageCapture);
>>
>>      string xp =
>> System.IO.Path.Combine(
>> Android.OS.Environment.ExternalStorageDirectory.Name,
>> "Android/data/com.myprereg.leads/file/capturedBadge.jpg");
>>      Java.IO.File xfile = new Java.IO.File(xp);
>>      if (xfile.Exists())
>>        xfile.Delete();
>>
>>      try
>>      {
>>        if (!xfile.Exists())
>>        {
>>          Console.WriteLine("File {0} does not exist", xp);
>>          xfile.ParentFile.Mkdirs();
>>          xfile.CreateNewFile();
>>        }
>>      }
>>      catch (Exception ex)
>>      {
>>        Console.WriteLine("Error: {0}", ex.Message);
>>      }
>>
>>
>>      _badgeFileUri = Android.Net.Uri.FromFile(xfile);
>>
>>      Console.WriteLine(_badgeFileUri);
>>
>>      intent.PutExtra(Android.Provider.MediaStore.ExtraOutput,
>> _badgeFileUri);
>>      StartActivityForResult(intent, TAKE_PICTURE);
>>    }
>>
>> --
>> View this message in context:
>> http://mono-for-android.1047100.n5.nabble.com/Using-the-device-camera-and-getting-a-result-OnActivityResult-is-NEVER-called-tp4902905p4902949.html
>> Sent from the Mono for Android mailing list archive at Nabble.com.
>> _______________________________________________
>> Monodroid mailing list
>> [email protected]
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>
>
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to