SurfaceHolder.setType is deprecated… But required?

后端 未结 1 1872
北海茫月
北海茫月 2020-12-29 19:39

void android.view.SurfaceHolder.setType(int type)

public abstract void setType (int type) Since: API Level 1

This method is deprecat

相关标签:
1条回答
  • 2020-12-29 20:26

    The trick is in knowing when it was deprecated, which is kind of hard to determine from my experience. The documentation is always current for the latest API available, but you are probably not running this app on the latest API, if I had to guess. So you still have to use this method (typically with PUSH_BUFFERS) to make it work on older platforms.

    EDIT: it was deprecated in Android 3.0, which the docs now reflect.
    So we can use it like following:

    if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
        getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    
    0 讨论(0)
提交回复
热议问题