title: Is it possible to handle R.array.string-array-name through a string variable in android studio?
body: <p>I have <strong>strings.xml</strong>  file like below:</p>
  
  <pre><code>&lt;string-array name="planet"&gt;
      &lt;item&gt;Earth&lt;/item&gt;
      &lt;item&gt;Mars&lt;/item&gt;
      &lt;item&gt;Jupiter&lt;/item&gt;
  &lt;/string-array&gt;
  </code></pre>
  
  <p>My <strong>activity_main.xml</strong> code segment for my spinner:</p>
  
  <pre><code>&lt;Spinner
     android:id="@+id/spinner"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"/&gt;
  </code></pre>
  
  <p>My <strong>MainActivity.java</strong> code segment:</p>
  
  <pre><code>    Spinner spinner = (Spinner) findViewById(R.id.spinner);
      ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.planet, android.R.layout.simple_spinner_dropdown_item);
      spinner.setAdapter(adapter);
      spinner.setOnItemSelectedListener(this);
  </code></pre>
  
  <p>Now I want to do this code like below:</p>
  
  <pre><code>    Spinner spinner = (Spinner) findViewById(R.id.spinner);
      String arrayName = "planet";
      ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.arrayName, android.R.layout.simple_spinner_dropdown_item);
      spinner.setAdapter(adapter);
      spinner.setOnItemSelectedListener(this); 
  </code></pre>
  
  <p>May I get the help that if it is possible then how to do this.</p>