Note that there are some explanatory texts on larger screens.

plurals
  1. POHow make Android self components and use it from a jar library?
    primarykey
    data
    text
    <p>I'm trying to create an android component that can be easily added to android projects as a jar library.</p> <p>For this, I had to create new xml attributes in "res/values/attr.xml" that I add to my graphic xml element using the path:</p> <pre><code> xmlns:app="http://schemas.android.com/apk/res/com.component.mypackage" </code></pre> <p>Then I import this project as a jar library into another project. To create my graphic components in the new project, I must change the path below:</p> <pre><code> xmlns:app="http://schemas.android.com/apk/res/com.mylibrary" </code></pre> <p>But the path is incorrect: the custom attributes are not found.</p> <p>I managed to integrate the R file in the library jar and I could access it from my xml to declare a custom component like this:</p> <pre><code>&lt;PreferenceScreen xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:app = "http://schemas.android.com/apk/res/com.myLibraryPackage"&gt; &lt;com.myLibraryPackage.mySelfComponent android:title="Name" android:key="name" app:hintText="Input your name" android:dialogTitle="Your name " app:validator="com.myLibraryPackage.myValidatorClass" /&gt; </code></pre> <p>What is strange is that if I put my file attr.xml in resources of my project, it works, which means it find com.myLibraryPackage.mySelfComponent. In that case, why it can't find also com.myLibraryPackage ?</p> <p>(I also tried replacing</p> <pre><code>xmlns:app="http://schemas.android.com/apk/res/com.myLibraryPackage" </code></pre> <p>by</p> <pre><code>xmlns:app="http://schemas.android.com/apk/res/com.myApplicationPackage" </code></pre> <p>but it still doesn't work)</p> <p>I would have preferred to use a jar to facilitate its integration in a project !</p> <p>Has anyone encountered a problem like this who could help me?</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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