"Activity A implements X" for unsupported API levels
<p>In an app I am writing, I want to support sharing through the <strong>ShareActionProvider</strong> class,  which is available for API levels >= 14.</p>

<p>However, I want to support all Android versions down to API level 9 (without supporting sharing).
I could write 2 apps with</p>

<p>a) API levels &lt; 14</p>

<pre><code>public class MyActiv extends Activity {}
</code></pre>

<p>b) API levels >=14</p>

<pre><code>public class MyActiv extends Activity implements OnShareTargetSelectedListener {}
</code></pre>

<p>Is there a way to keep everything in a unique java file ?</p>

<p>I've looked into reflection and delegation but can't figure anything conclusive yet.</p>
