问题描述:

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.

相关阅读:
Top