android - Bind MemoryFile to a service fails -


i trying bind service activity, on bind returns memory file object created in service.

the problem is, during onserviceconnected() callback in activity, can receive type of object service class, except memoryfile type object, created in service class.

the service fails bind activity when there memoryfile object.

the service class below

public class remoteservice extends service {  ibinder mbinder = new localbinder(); memoryfile mfile;  @override public ibinder onbind(intent intent) {     // todo auto-generated method stub     try {         if(mfile == null)         mfile = new memoryfile("mem", 1024);     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }     return mbinder; } public class localbinder extends binder {     public memoryfile getmemoryfile() {            return mfile;           }     }   } 

and inside activity, onserviceconnected() callback happens

public void onserviceconnected(componentname name, ibinder service) { toast.maketext(mainactivity.this, "service connected", 1000).show(); mbounded = true; localbinder mlocalbinder = (localbinder)service; memoryfile = mlocalbinder.getmemoryfile(); }


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -