1

I have two Android projects in my Workspace. Now, I want to access the res/layout files of second project in the activity/Java class of my first project.

I have already added the second project as a library of first project but its not working. Do I need to give the path in setContentView(R.layout.main) or something like that. Please suggest.

FYI: I am working on 4.2 version of Android.

Regards, Anupriya

  • possible duplicate of [how to access resources in a android library project](http://stackoverflow.com/questions/16053141/how-to-access-resources-in-a-android-library-project) – Ab5 Feb 27 '15 at 07:00
  • possible duplicate of [refer to android library project xml resource in application xml resource](http://stackoverflow.com/q/12676513/1833437) & – Ab5 Feb 27 '15 at 07:02

2 Answers2

0

I have tried with same on my end you can directly access layout file with its name After adding library please clean project and then try to access file from resource folder of another project i.e.

setContentView(R.layout.layout_from_other_project);
Anand Phadke
  • 531
  • 3
  • 28
0

You probably would need to add your own uri for library and use it to refer to drawable.

xmlns:libProj="http://schemas.android.com/apk/res/com.test.mylib"

Then you should be able to access drawable using

@libProj:drawable/myImage
Nauman Afzaal
  • 1,046
  • 12
  • 20