title: onReceive Android running more than once
body: <p>So I have an activity called TreeActivity() where I ask a service for a object. Then I get the response in a private class called TreeReceptor() which only has this function:</p>
  
  <pre><code>public void onReceive(final Context context, final Intent intent) {
      if (intent.getAction().equals(TreeReceptor.tree)) {
          CustomSerializable root;
          root = (CustomSerializable) intent.getSerializableExtra("tree");
          GenerationTree treeGen = new GenerationTree(root);
          treeGen.run();
      }
  }
  </code></pre>
  
  <p>The GenerationTree class is this one:</p>
  
  <pre><code>private class ReportGeneration extends Thread {
      private CustomSerializable root;
      public ReportGeneration(CustomSerializable root) {
          this.root = root;
      }
      public final void run() {
          System.out.println(root.getName());
      }
  
  }
  </code></pre>
  
  <p>In my Activity I have a button which sends the action to the service, and then the service sends the CustomSerializable object. I receive everything correctly, the only problem is that the onReceive function gets executed more than once.
  For example: if it's the first time I click the button it won't do anything. If it's the second time it will execute the onReceive function twice, if it's the third time it will execute it three times, and so on...</p>
  
  <p>It's my first time doing an Android app and I'm quite lost, any ideas what it could be? I've found some other questions saying that for some specific devices it executes the function more than once, so just for some info, I'm emulating my project in a <code>Nexus 5 API23 x86 Andriod 6.0</code></p>