How to set the values in onRestoreInstanceState in android?
<p>I need to make my android app work in both portrait mode and in landscape mode. In my activity I had a counter where next button is clicked the counter numerator value will be incremented and when previous button is clicked the counter numerator value will reduce. The denominator value is the total. </p>

<p>Screen header:<img src="http://i.stack.imgur.com/bGUdc.png" alt="enter image description here"> </p>

<p>Code:</p>

<pre><code>public void previouscall(View v) {
            k--;
            }


public void nextcall(View v) {
            k++;
            }




    @Override
    protected void onSaveInstanceState(Bundle outState) {
        // TODO Auto-generated method stub
        super.onSaveInstanceState(outState);
        outState.putString("FIRST", numerator);
        outState.putString("SECOND", denominator);
    }

    String first = "";
    String second = "";

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onRestoreInstanceState(savedInstanceState);

        first = savedInstanceState.getString("FIRST");
        second = savedInstanceState.getString("SECOND");

        number.setText(("COUNT : ").concat(first.trim().concat("/")
                .concat(second )));

            }
</code></pre>

<p>When this activity starts I am turning the screen to both portrait and landscape and checking the count values. i.e first in portrait mode i clicked next button and so the val 1/4 becomes 2/4. But when i changed the screen to landscape again it is displaying 1/4. I used onsaveinstancestate and onrestoreinstance state but even then the same problem. How can I solve this issue? Any help will be thankful.</p>
