title: How to include a XML layout file inside a Java Jar file
body: <p>I want to include a XML layout file inside my Java Jar file, which i want to use it for Android.  I am trying to do something like this in my library jar file. </p>
  
  <pre><code>public class Library {
  
      Activity activity;
  
      public Library(Activity activity){ 
          this.activity = activity;
      }
  
      public void ABC() {
          Toast.makeText(activity,"ABC started",Toast.LENGTH_LONG).show();
          istream = getClass().getResourceAsStream("/res/layout/activity.xml");
          // xAxis is inside my activity.xml file
          TextView tvX= (TextView)this.activity.findViewById(R.id.xAxis);
      }
  }
  </code></pre>
  
  <p>But when i imported above jar file in my below android application and used like this, it is showing error 
      java.lang.NoClassDefFoundError: com.example.library.R$id at com.example.library.Library.ABC". </p>
  
  <p>I am really not getting what is the problem?</p>
  
  <pre><code>public class CheckLibrary extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.check_library);
          Library lib = new Library(this);
          lib.ABC();
      }
  }
  </code></pre>