title: How to start another activity while passing context of mainActivity?
body: <p>I am starting other activity using intent from MainActivity. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>Intent intent = new Intent(this, ProgramClass.class);
  startActivity(intent);
  </code></pre>
  
  <p>Now I want to access string.xml file in ProgramClass but <code>getResources()</code>, <code>getApplicationContext()</code>,<code>getContext()</code> are not able to get me that stringArray defined string.xml file. </p>
  
  <p>As it generating an error, the possible solution I have is to create a constructor &amp; pass context to ProgramClass from MainActivity(). </p>
  
  <p>but for doing that I need to create an object of ProgramClass in MainActivity while using an explicit Intent which takes .class parameter. How can I start an intent or another activity by passing context of MainActivity?</p>