Hi folks
I made a little change to SpinnerActivity from the Android Junit
tutorial:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
dialog = new Dialog(SpinnerActivity.this);
dialog.setContentView(R.layout.main);
Spinner spinner = (Spinner)
dialog.findViewById(R.id.Spinner01);
this.mAdapter = ArrayAdapter.createFromResource(this,
R.array.Planets,
android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(this.mAdapter);
OnItemSelectedListener spinnerListener = new
myOnItemSelectedListener(this,this.mAdapter);
spinner.setOnItemSelectedListener(spinnerListener);
dialog.show();
}
No magic, all I did was create a Dialog (named dialog) and display the
widgets on it.
Then I changed the setUp method in the SpinnerActivityTest code to
look like:
protected void setUp() throws Exception {
super.setUp();
setActivityInitialTouchMode(false);
mActivity = getActivity();
mSpinner =
(Spinner) mActivity.findViewById(
com.android.example.spinner.R.id.Spinner01
);
All I'm trying to do is get ahold of the Dialog I introduced. The
problem is, its not working. mSpinner is coming back as null.
What am I doing wrong? How do I get ahold of the Dialog? Failing
that, how do I get ahold of the Spinner that in the Dialog?
This is driving me nuts!
Mark
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en