MonoDroid Camera.IshutterCalBack

时间:2011-05-12 22:34:39

标签: android mono xamarin.ios xamarin.android

有人可以发布如何将以下java转换为c#(monodroid)吗?

// Handles data for raw picture
  PictureCallback rawCallback = new PictureCallback() { // <7>
    public void onPictureTaken(byte[] data, Camera camera) {
      Log.d(TAG, "onPictureTaken - raw");
    }
  };

1 个答案:

答案 0 :(得分:1)

C#不允许像Java那样的匿名类,所以你必须定义一个实现接口的类(Java中的PictureCallback,Android的Mono中的IPictureCallback):

private class PictureCallback : Java.Lang.Object, Android.Hardware.Camera.IPictureCallback 
{
    public void  OnPictureTaken(byte[] data, Android.Hardware.Camera camera)
    {
        Log.Debug(TAG, "onPictureTaken - raw");
    }
}