title: How to clear intent data in Activity after open from url?
body: <p>I have <code>Activity</code>, which can be launched directly from browser, calling url.</p>
  
  <p>Activity code:</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          Uri data = getIntent().getData();
          Log.d(getClass().getName(), "onCreate data=" + data);
  
          getIntent().replaceExtras(new Bundle());
          getIntent().setAction("");
          getIntent().setData(null);
          getIntent().setFlags(0);
  
          if (data != null &amp;&amp; isValidUrl(data)) {
              // open some special fragment
          } else {
              // open main fragment
          }
      }
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          Log.d(MainActivity.class.getName(), "onDestroy");
      }
  
      //...
  }
  </code></pre>
  
  <p>Application manifest code:</p>
  
  <pre><code>    ...
  
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"/&gt;
              &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.VIEW"/&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
  
              &lt;data
                  android:host="example.com"
                  android:pathPrefix="/"
                  android:scheme="http"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      ...
  </code></pre>
  
  <p>This code works perfectly. When I open application from browser using link (<code>http://example.com/somepage.html</code>), I have this output:</p>
  
  <pre><code>D/com.package.MainActivity: onCreate data=http://example.com/somepage.html
  </code></pre>
  
  <p>But if I leave the application (using back button) and open application again, from recent menu, I get the same result:</p>
  
  <pre><code>D/com.package.MainActivity: onDestroy
  D/com.package.MainActivity: onCreate data=http://example.com/somepage.html
  </code></pre>
  
  <p>I want to clear intent data in method <code>onCreate</code>. Or is there way to detect, when application is launched from recent menu?</p>
  
  <p><strong>UPD:</strong>
  I tried to do this:</p>
  
  <pre><code>@Override
  protected void onDestroy() {
      super.onDestroy();
  
      getIntent().replaceExtras(new Bundle());
      getIntent().setAction("");
      getIntent().setData(null);
      getIntent().setFlags(0);
  
      Log.d(MainActivity.class.getName(), "onDestroy");
  }
  </code></pre>
  
  <p>But it does not help.</p>