When does the Bitmap property of a PreviewView become available?

Nathan Sokalski 4,121 Reputation points

I have an AndroidX.Camera.View.PreviewView from which I want to continuously/periodically look at the value of the Bitmap property. However, immediately after starting the preview, the Bitmap property is null, so trying to look at the Bitmap property is not possible, and I am not sure how to detect when it becomes available. If possible, I do not want to stop displaying preview when looking at the Bitmap property. How can I detect when the Bitmap property becomes available?

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,300 questions
Microsoft Technologies based on the .NET software framework.
3,450 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,364 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 36,951 Reputation points Microsoft Vendor


    After further investigation, you could detect to Bitmap's values using delegates and non-blocking threads, please refer to the following code example:

    public delegate void DelegateWithParameters(PreviewView p);
    // implement the delegate method
    private void DetectBitMap(PreviewView p)
        while (true)
            if (p.Bitmap != null)
    // invoke this method
    DelegateWithParameters delFoo =
    new DelegateWithParameters(DetectBitMap);
    delFoo.BeginInvoke(viewFinder, null, null);

    Best Regards,

    Alec Liu.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments