If i understand various messages i've read on this board correctly, you can not bundle Android resources in a shared library. You can only bundle share classes (and regular java-resources, i hope) in JARs.
I was trying to do the same, sharing layouts, bitmaps, etc among a suite of applications. It did not work, because Android resources can not be shared from a jar to an apk. Any Android engineer; correct me if i'm wrong (i hope i am :=)). On Mar 20, 11:31 am, madcoder <paperga...@gmail.com> wrote: > I'm trying to build an alert dialog with a builder. The code is from > the svn here: > > http://code.google.com/p/apps-for-android/source/browse/trunk/DivideA... > > There is also a web site with description of how to use the code > here:http://androiddevstudio.com/tutorials/adding-eula-to-android-app/comm... > > So far the class successfully runs this code: > > ...previous code > builder.setPositiveButton(com.mywebsite.MyLib.R.string.eula_accept, > new DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, int which) > { > accept(preferences); > if (activity instanceof OnEulaAgreedTo) { > ((OnEulaAgreedTo) activity).onEulaAgreedTo(); > } > } > }); > > Then I try to run this code immediately after it: > > builder.setNegativeButton(com.mywebsite.MyLib.R.string.eula_refuse, > new DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, int which) > { > refuse(activity); > } > }); > > And then I get Force Close. I've placed several log messages in my > code for debug and I'm fairly certain this is where it hangs up. > > The DDMS indicates: > > W 535 ResourceType getEntry failing because entryIndex 3 is beyond > type entryCount 3 > W 535 ResourceType Failure getting entry for 0x7f040003 ( t=3 e=3 ) > in package 0: 0x80000001 > > I have commented out this single builder.setNegativeButton code and > the file runs with no force closure. I'm also absolutely sure that > both string resources are in the strings.xml file. > > You may notice my string designation: > > com.mywebsite.MyLib.R.string.eula_accept > > This is because I'm trying to access this eula from a reusable library > class. This is where is gets a little weird. The title in the dialog > displays this: > > "res/raw/button_click.ogg" > > And the accept button at the bottom of the dialog displays this text: > > "res/raw/instructions.ogg" > > Those files are both from the main project itself, in another package, > hence the use of long definitions for the string files. Unfortunately > it still doesn't access those strings. > > I would like to know how to do this correctly, so I can reuse this > library class. And more importantly, so I can understand what I'm > doing wrong. > > I'm using Eclipse and the latest SDK of Android. > > Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---