本文整理汇总了Java中android.view.TextureView.setSurfaceTexture方法的典型用法代码示例。如果您正苦于以下问题:Java TextureView.setSurfaceTexture方法的具体用法?Java TextureView.setSurfaceTexture怎么用?Java TextureView.setSurfaceTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.TextureView
的用法示例。
在下文中一共展示了TextureView.setSurfaceTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import android.view.TextureView; //导入方法依赖的package包/类
/**
* Creates instances of TextureRender and SurfaceTexture, and a Surface associated
* with the SurfaceTexture.
*/
private void setup() {
mTextureView = new TextureView(mContext);
mTextureRender = new TextureRender();
mTextureRender.surfaceCreated();
// Even if we don't access the SurfaceTexture after the constructor returns, we
// still need to keep a reference to it. The Surface doesn't retain a reference
// at the Java level, so if we don't either then the object can get GCed, which
// causes the native finalizer to run.
if (VERBOSE) Log.d(TAG, "textureID=" + mTextureRender.getTextureId());
mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId());
mTextureView.setSurfaceTexture(mSurfaceTexture);
task = new TimerTask() {
public void run() {
if (VERBOSE) Log.d(TAG, "new frame available");
synchronized (mFrameSyncObject) {
mFrameSyncObject.notifyAll();
}
}
};
timer = new Timer();
timer.scheduleAtFixedRate(task, 25, 25);
}
示例2: recreateView
import android.view.TextureView; //导入方法依赖的package包/类
/**
* Performs partial construction. The VideoBlob is already created, but the Activity
* was recreated, so we need to update our view.
*/
public void recreateView(TextureView view) {
Log.d(LTAG, "recreateView: " + view);
mTextureView = view;
mTextureView.setSurfaceTextureListener(this);
if (mSavedSurfaceTexture != null) {
Log.d(LTAG, "using saved st=" + mSavedSurfaceTexture);
view.setSurfaceTexture(mSavedSurfaceTexture);
}
}