title: Remove Activity as Default Launcher
body: <p>I set my activity as a default launcher to intercept home button clicks like so:</p>
  
  <pre><code>&lt;activity
      android:name=".ExampleActivity"
      android:label="@string/app_name"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MAIN" /&gt;
          &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;category android:name="android.intent.category.HOME" /&gt;        
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;               
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>When my activity, <code>ExampleActivity</code> is launched, if i click the <kbd>home</kbd> key, I get prompted to choose. If I select <em>make this my default</em> and chose my activity, I am stuck In my activity as desired.</p>
  
  <p>The problem is, when I leave the activity, I try to remove my activity from the default launcher, but am unsuccessful.</p>
  
  <p>I have tried:</p>
  
  <pre><code>ComponentName componentName = new ComponentName( 
                      "com.example.exampleactivity", 
                      "com.example.exampleactivity.class");
  
  pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP);
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>PackageManager pm = getActivity().getPackageManager();
               ComponentName name = new ComponentName(this, "com.example.exampleactivity.class");
               pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
  </code></pre>
  
  <p>But my designation for the <kbd>home</kbd> is never removed.</p>
  
  <p>Does anyone have a working way to fix the above? </p>
  
  <p>I only wan't the home button to be default for a specific activity, not my entire application. When I leave the activity, it should be removed and restored to default.</p>