Skip to content

Instantly share code, notes, and snippets.

@JonDouglas
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonDouglas/0eeee51e08e63bda7a46 to your computer and use it in GitHub Desktop.
Save JonDouglas/0eeee51e08e63bda7a46 to your computer and use it in GitHub Desktop.
MainActivity
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace NewCameraBroadcast
{
[Activity(Label = "NewCameraBroadcast", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
MyReceiver mr = new MyReceiver();
RegisterReceiver(mr, new IntentFilter(Android.Hardware.Camera.ActionNewPicture));
Intent i = new Intent();
i.SetAction("android.hardware.action.NEW_PICTURE"); //or i.SetAction(Android.Hardware.Camera.ActionNewPicture);
SendBroadcast(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment