Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Library project is referenced as a raw project dependency (source-based mechanism), not as a compiled jar dependency (compiled-code based library mechanism).</p> </blockquote> <p>@yorkw this is not true for the latest versions of ADT Plugin for Eclipse <a href="http://developer.android.com/sdk/eclipse-adt.html" rel="noreferrer">http://developer.android.com/sdk/eclipse-adt.html</a></p> <p><strong>From version 17 Change log</strong></p> <blockquote> <p>New build features Added feature to automatically setup JAR dependencies. Any .jar files in the /libs folder are added to the build configuration (similar to how the Ant build system works). Also, .jar files needed by library projects are also automatically added to projects that depend on those library projects. (more info)</p> </blockquote> <p>More info <a href="http://tools.android.com/recent/dealingwithdependenciesinandroidprojects" rel="noreferrer">http://tools.android.com/recent/dealingwithdependenciesinandroidprojects</a></p> <p>Before that, update overwriting of the Activity from Library project was easy, just exclude the class. Now the library is included as jar file, and there is no way to exclude class file from jar dependency.</p> <p>EDIT:</p> <p>My solution to overwrete/extend Activity from library jar:</p> <p>I created a simple util class:</p> <pre><code>public class ActivityUtil { private static Class getActivityClass(Class clazz) { // Check for extended activity String extClassName = clazz.getName() + "Extended"; try { Class extClass = Class.forName(extClassName); return extClass; } catch (ClassNotFoundException e) { e.printStackTrace(); // Extended class is not found return base return clazz; } } public static Intent createIntent(Context context, Class clazz) { Class activityClass = getActivityClass(clazz); return new Intent(context, activityClass); } } </code></pre> <p>In order to overwrite a library's "SampleActivity" class it a the project which depends on that library, create a new class with the name SampleActivityExtended in the project in the same package and add the new activity to your AndroidManifest.xml.</p> <p>IMPORTANT: all intents referencing overwritten activities should be created through the util class in the following manner:</p> <pre><code>Intent intent = ActivityUtil.createIntent(MainActivity.this, SampleActivity.class); ... startActivity(intent); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload