title: can i pass interface to a service in android?
body: <p>I have an interface like this:</p>
  
  <pre><code>public interface MyInterface {
      public void aMethod();
  }
  </code></pre>
  
  <p>My custom activity:</p>
  
  <pre><code>public class MyObject extends Activity {
  
      private Context context;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            start(5,MyInterface handle);
      }
       public void start(final int duration,  MyInterface handle){ 
       Intent intent = new Intent(getApplicationContext(),myService.class);
              intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  
              Bundle bundle = new Bundle();
              //Eroor !*** i can't pass handle.aMethod() to my service ***
              bundle.putSerializable("handle",bundle.getSerializable(handle.aMethod()));
              intent.putExtras(bundle);
              startService(intent);
      }
  }
  </code></pre>
  
  <p>I have a service:</p>
  
  <pre><code>public class myService extends Service {
  }
  </code></pre>
  
  <p>I want implement my interface method in my service. my activity pass interface method to service and start it.</p>
  
  <p>I can't pass handle.aMethod() to my service.</p>
  
  <p>How can i pass an interface to a service in an activity method?</p>