0

I am creating an Android keyboard with Eclipse. I want to implement popup keyboards which show up when you long press a key.

Therefore I assigned the

android:popupKeyboard="@xml/a_popup"

property to the key-tag and created a popup keyboard under "res/xml/a_popup.xml"

That works fine, but since I want a lot of different popup keyboards and I don't want them all to be directly in "res/xml/", so I moved the "a_popup.xml" file to "res/xml/popup_keyboards/"

But now I can't make a reference to the xml-file any more from my popupKeyboard-property by saying

android:popupKeyboard="@xml/popup_keyboards/a_popup"

If I do so, I get the message, that there is no resource which matches the given name. There is also no entry in the R.java file, although I cleaned the project.

I also tried to reference the popup keyboard by an ID but then I get a ResourcesNotFound Exception everytime I longpress the button.

Has anybody an idea why this happens?

Till S
  • 455
  • 5
  • 15
  • does eclipse show you errors in the error view? – CAA May 27 '12 at 16:14
  • I only get the the error in my code which says "No resource found that matches the given name (at 'popupKeyboard' with value '@xml/popup_keyboards/a_popup')." and I can't build my project. – Till S May 27 '12 at 16:19
  • The resource file can not have subdirectories. [See this question.][1] [1]: http://stackoverflow.com/questions/1077357/can-the-android-drawable-directory-contain-subdirectories – cstrutton May 27 '12 at 16:25
  • ok thanks, now at least I know why it happens – Till S May 27 '12 at 16:30

1 Answers1

0

You can't use nested lists in resources in Android. "res/xml/popup_keyboards/" - it's wrong, you can't create directories under xml dir, only files.

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • ok, if that isn't possible I would try to reference the keyboards by their IDs. Then I could pack mulitple keyboard layouts in one xml file. But unfortunately that doesn't seem to work either. – Till S May 27 '12 at 16:32
  • Why you don't do like this: "res/xml/a_popup.xml", "res/xml/a_popup2.xml", "res/xml/a_popup3.xml" ? – Rubycon May 27 '12 at 16:40
  • I need popups for about 20 keys of my keyboard. That would spam the res/xml/ folder pretty much. – Till S May 27 '12 at 16:42
  • It's OK, there isn't other solution. – Rubycon May 27 '12 at 17:20
  • ok thank you, I has to work for now but I will change that later on – Till S May 27 '12 at 18:32