当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Extracting surfaceView, surfaceHolder when passed through intent

问题描述:

While creating a service as need be, surfaceView & surfaceHolder are being passed via intent to a service. How can the same be extracted at the service side.

Have been trying this but not able to succeed.

ACTIVITY :

intent2.putExtra("surfaceView",mSurfaceView.toString());

intent2.putExtra("surfaceHolder",mSurfaceHolder.toString());

SERVICE:

Object view_obj = intent.getExtras().get("surfaceView");

mSurfaceView = (SurfaceView) view_obj;

Object holder_obj=intent.getExtras().get("surfaceHolder");;

mSurfaceHolder = (SurfaceHolder) holder_obj;

网友答案:

You cannot pass any View via an Intent extra. While you could implement Parcelable on your SurfaceHolder implementation, all that will do is give your service a copy of the SurfaceHolder, one that is not attached to any SurfaceView.

分享给朋友:
您可能感兴趣的文章:
随机阅读: