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);
}
答案 0 :(得分:0)
尝试使用getInt()
savedInstanceState.getInt("Id"+"["+i+"]", 0); //0 is default value