I too would like this ability in the future :)

-----Original Message-----
From: monodroid-boun...@lists.ximian.com
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Ritesh Sahu
Sent: Wednesday, August 03, 2011 12:30 AM
To: Jonathan Pobst; Discussions related to Mono for Android
Subject: Re: [mono-android] Resources from a Library Project

Thanks Jonathan.
I've seen that even if I don't try to use resources we can't put anything UI
related in library projects.
For example:
I have a Library project (lets call it LibProj) I have an Activity
(Activity1) in LibProj which loads a layout using 

SetContentView(Resource.Layout.Main); 

The Layout Main.axml is within that library project.

Now I have a Mono Android Application Project (AppProj) which references
LibProj and then creates an intent to start a Activity1:

Intent intent = new Intent(this, typeof(LibProj.Activity1));
StartActivity(intent);


What happens to this call completely depends on what const Id was generated
for Resource.Layout.Main and if the AppProj has something in the Resource
file with a similar Id. I've seen it loading a completely different layout
(a layout defined in AppProj).


With this behavior, it's almost impossible to use Library projects except
for business logic (I guess that's why the Resource folder hierarchy is not
generated in Library projects). Anything UI related (Activity, View, Layout
etc) have to be put in the Application Project.

I certainly hope this is something that gets fixed soonish otherwise it'll
make it very difficult for us to develop applications of any decent
complexity using Mono for Android if we have to put all UI stuff in one
project.

- Ritesh

-----Original Message-----
From: Jonathan Pobst [mailto:mon...@jpobst.com]
Sent: Wednesday, 3 August 2011 1:37 PM
To: Discussions related to Mono for Android
Cc: Ritesh Sahu
Subject: Re: [mono-android] Resources from a Library Project

There is currently no support for sharing resources across projects.

You will need to copy (or link) the resources into each project.

Hopefully there will eventually be a better solution for this.

Jonathan


On 8/2/2011 7:09 PM, riteshsahu wrote:
> I've looked a bit more into this and by the looks of it the R.java
created
> only contains the ID from the Application and doesn't contain anything
from
> the Libraries. The values assigned to these constants are overlapped
between
> different projects (// aapt resource value: 0x7f020000).
>
> Using these results in the app trying to load the named resource from
the
> application rather than the library.
>
> Again, what is the recommended way of sharing resources across
projects?
>
> --
> View this message in context:
http://mono-for-android.1047100.n5.nabble.com/Resources-from-a-Library-P
roject-tp4657828p4660735.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>



Click
https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==
eHGjiy6gkGpcMqwkE3vFhNIomf0VqRQWLTieLvRJKIvyA==  to report this email as
spam.
--------------------------------------------------------

This e-mail is for the use of the intended recipient(s) only. If you have
received this e-mail in error, please notify the sender immediately and then
delete it. If you are not the intended recipient, you must not use, disclose
or distribute this e-mail without the author's prior permission. We have
taken precautions to minimize the risk of transmitting software viruses, but
we advise you to carry out your own virus checks on any attachment to this
message. We cannot accept liability for any loss or damage caused by
software viruses. Any views and/or opinions expressed in this e-mail are of
the author only and do not represent the views of Epicor Software
Corporation or any other company within its group.


This message has been scanned for malware by Websense. www.websense.com
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to