Gives category Spinner an ID

Without an ID, the default save/restore state mechanism doesn't work,
so (for example) if you rotate the screen on ICS, the current category
switches back to the default.
This commit is contained in:
Ciaran Gultnieks 2012-09-16 10:08:30 +01:00
parent 42d2070701
commit 0eaca35e5b
2 changed files with 7 additions and 0 deletions

4
res/values/ids.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="categorySpinner" />
</resources>

View File

@ -298,6 +298,9 @@ public class FDroid extends TabActivity implements OnItemClickListener,
LinearLayout v = new LinearLayout(FDroid.this);
v.setOrientation(LinearLayout.VERTICAL);
Spinner cats = new Spinner(FDroid.this);
// Giving it an ID lets the default save/restore state
// functionality do its stuff.
cats.setId(R.id.categorySpinner);
cats.setAdapter(categories);
cats.setOnItemSelectedListener(FDroid.this);
v.addView(cats, new LayoutParams(