Giter Club home page Giter Club logo

Comments (2)

DavidWhitman avatar DavidWhitman commented on June 6, 2024 1

That works perfectly. : Java.Lang.Object, was the missing key.

Thank you so much. Up to you whether to leave this open; I did ask for help on a large C# Discord server and nobody who answered could figure it out either.


Note to anyone finding this later:
The list you return from filter must be modifiable (the Java implementation calls retainAll on it).

Therefore, simply returning the same list passed in (p0) will result in a Java.Lang.UnsupportedOperationException. Calling ToList() on it fixes it.


Also, LensFacing is not the same as the lens id. There doesn't seem to be a way to get that directly from CameraInfo, so you'll need to store that mapping in memory elsewhere and do a lookup.

from androidx.

jpobst avatar jpobst commented on June 6, 2024

I think it would be something like:

var selector = new CameraSelector.Builder ()
                    .AddCameraFilter (new MyCameraFilter ())
                    .Build ();

class MyCameraFilter : Java.Lang.Object, ICameraFilter {
    public IList<ICameraInfo> Filter (IList<ICameraInfo> p0) => p0.Where (c => c.LensFacing == 3);
}

from androidx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.