Null pointer exception while restoring value
<pre><code>protected void onRestoreInstanceState(Bundle savedInstanceState)
{
    super.onRestoreInstanceState(savedInstanceState);
    for(int i=0;
    i&lt;teeth.length;
    i++)
    {
        teeth[i]=(Integer) savedInstanceState.get("Id"+"["+i+"]");
        if(teeth[i]!=0)
        {
            teeth[i]=i+1;
            backselection.add(teeth[i]);
            Ateeth[i].setBackgroundResource(imgid[i]);
            currentselection.setText("CurrentSelection:"+backselection);
        }
    }
}
protected void onSaveInstanceState(Bundle outState)
{
    for(int i=0;
    i&lt;teeth.length;
    i++)
    {
        outState.putInt("Id"+"["+i+"]", teeth[i]);
    }
    super.onSaveInstanceState(outState);
}
</code></pre>
