Android: Trouble Displaying a Random Number to Screen
<p>I am trying to print a randomly generated integer to the screen. I looked at a couple other people's questions on how to do it and here is my attempt:</p>

<pre><code>@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_program);
        TextView currentNumber = new TextView(this);
        // randNum() generates the random number and returns it (returns int)
        currentNumber.setText(randNum()); 
        this.setContentView(currentNumber);
    }
</code></pre>

<p>When I try to open the current activity, however, (emulator) the app stops working. What am I doing wrong? Also, I will be planning on allowing the user to generate a new random number later on and I want the display to update the <code>currentNumber</code> variable (overwriting the first number). Is this the best way of doing it or is there a better way?</p>
