Last active
August 29, 2015 14:06
-
-
Save JonDouglas/0eeee51e08e63bda7a46 to your computer and use it in GitHub Desktop.
MainActivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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