Android - compile error when implementing ServiceConnection -


i working on adding in-app billing , working this official documentation

and on section binding iinappbillingservice

here code:

public class communityactivity extends baseactivity implements serviceconnection {        arrayadapter<chatmessage> adapter;     dialog dialog;     arraylist<chatmessage> chat = new arraylist <chatmessage>( );             iinappbillingservice mservice;      serviceconnection mserviceconn = new serviceconnection() {            @override            public void onservicedisconnected(componentname name) {                mservice = null;            }             @override            public void onserviceconnected(componentname name,                ibinder service) {                mservice = iinappbillingservice.stub.asinterface(service);            }         };      /** called when activity first created. */     @override     public void oncreate(bundle savedinstancestate)      {         super.oncreate(savedinstancestate);         flurryagent.onstartsession(this, "8ca5ltz5m73eg8r35sxg");          setcontentview(r.layout.community);          bindservice(new                  intent("com.android.vending.billing.inappbillingservice.bind"),                         mserviceconn, context.bind_auto_create); 

but compile errors saying have implement onserviceconnected , onservicedisconnected methods. thought added them in way example suggested.

where did go wrong here? thanks!

the error because have declared class follows

public class communityactivity extends baseactivity implements serviceconnection

now compiler expects u have these 2 functions onserviceconnected , on servicedisconnected implemented in communityactivity. cannot find them in class.

remove implements serviceconnection , code should compile successfully.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -