Null pointer exception while restoring value
protected void onRestoreInstanceState(Bundle savedInstanceState) {	    	super.onRestoreInstanceState(savedInstanceState);for(int i=0;i<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<teeth.length;i++){
outState.putInt("Id"+"["+i+"]",  teeth[i]);}super.onSaveInstanceState(outState);}
Null pointer exception while restoring value
===

protected void onRestoreInstanceState(Bundle savedInstanceState) {	    	super.onRestoreInstanceState(savedInstanceState);for(int i=0;i<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<teeth.length;i++){
outState.putInt("Id"+"["+i+"]",  teeth[i]);}super.onSaveInstanceState(outState);}