Random Int Function Generating Application Force Close
<p>I am having difficulty finding out why the following line of code is generating a 'Force Close' in my Android Application:</p>

<pre><code>    fact = myArray[randfact.nextInt(myArray.length)];
</code></pre>

<p>I have an arracy of interesting facts - just a Siring Array.  It's defined in a file called array.xml and it has the name <code>myArray</code>.</p>

<p>The actual code snippet to generate the random fact is:</p>

<pre><code>Random randfact = new Random();
fact = myArray[randfact.nextInt(myArray.length)];
</code></pre>

<p>where <code>fact</code> is of type string and I define <code>myArray</code> as an <code>Array</code> of <code>Strings</code> PRIOR to the above two lines of code:</p>

<pre><code>String fact;    
String[] myArray;
</code></pre>

<p>I believe the culprit is:  </p>

<pre><code>fact = myArray[randfact.nextInt(myArray.length)];
</code></pre>

<p>because when I comment out the line as such:</p>

<pre><code>//fact = myArray[randfact.nextInt(myArray.length)];
</code></pre>

<p>my Application no longer generates a 'Force Close'. Does anyone notice anything? I can't seem to find it!!!</p>
