Bug 4459 - Using resources by other project (external assembly)
Summary: Using resources by other project (external assembly)
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.1.x
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
: 5374 ()
Depends on:
Blocks:
 
Reported: 2012-04-16 08:49 UTC by Marco
Modified: 2012-09-18 03:25 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Marco 2012-04-16 08:49:16 UTC
Hi, 
 I have created two Monondroid projects in my solution in Monodevelop. 
The first is called "CustomerProject", and the other called "StandardProject" 

Inside of "StandardProject" I have created a Splash view called "SplashView". 

Now I want use SplashView in my "CustomerProject". I already referenced "StandardProject" into "CustomerProject"  (I right-clicked on References of CustomerProject --> Edit References --> Projects and I selected the StandardProject. 

On the OnCreate Method of Main launcher in CustomerProject: 
protected override void OnCreate (Bundle bundle) 
{ 
        base.OnCreate (bundle); 

        var Splash = new Intent(this,typeof(StandardProjectNameSpace.SplashView)); 
        StartActivity (Splash); 
} 

On the OnCreate Method of splashView in StandardProject: 
protected override void OnCreate (Bundle bundle) 
{ 
        try { 
                        base.OnCreate (bundle); 
                        SetContentView (Resource.Layout.SplashView); 

                        dialogPr = FindViewById<ProgressBar>(Resource.Id.progressbar); 
                       [...]	
        } catch (Exception ex) { 
        } 
} 

But dialogPr is NULL!!!

It's possible to do this configuration or  I must to copy/create a new SplashView in the CustomerProject?

Thanks
Comment 1 Jonathan Pobst 2012-04-25 16:01:01 UTC
Resources put in libraries are not automatically copied into the main project.  For now, you will need to put the resources in both the library and the main project.
Comment 2 Jonathan Pobst 2012-05-29 17:57:59 UTC
*** Bug 5374 has been marked as a duplicate of this bug. ***
Comment 3 Sebastian Krysmanski 2012-07-05 12:47:12 UTC
For now you can use "EmbeddedResources" as an alternative:

private Drawable GetDrawable(string filename) {
  Assembly assembly = Assembly.GetExecutingAssembly();
  Stream resStream = assembly.GetManifestResourceStream(ASSEMBLY_NAMESPACE + ".Resources.Drawable." + filename);
  return new BitmapDrawable(this.Resources, resStream);
}
Comment 4 Atsushi Eno 2012-09-18 03:25:24 UTC
This will be supported in the next release.