android - IBinder between Bound Service and Activity -
maybe i'm tired. struggling understand how ibinder interface works.
a service has method call onbind(intent intent) , passes form of ibinder binding activity.
where struggling how visualize this. ibinder object pipe between service , activity, activity can interact directly service? or ibinder object passed activity has information service in (similar intent)?
edit: idea me able call getsomedata function binding activity. or rather, idea msomedata obect activity.
i have following classes using, , im trying figure out best way have activity request data (serializable if needed though i'd rather not) service.
public class mainservice extends service{ private custombinder mibinder; private somedataobject msomedata; @override public int onstartcommand(intent intent, int flags, int startid) { mibinder = new custombinder(); return super.onstartcommand(intent, flags, startid); } @override public custombinder onbind(intent intent) { // todo: return communication channel service. // auto generated , havent changed yet. not // experiencing errors not designed run yet. throw new unsupportedoperationexception("not yet implemented"); } public final somedataobject getsomedata(){ return msomedata; } class somebinder extends mainenginebinder{ // auto generated stuff } }
Comments
Post a Comment