ArrayAdapter - Making a spinner?
http://developer.android.com/resources/tutorials/views/hello-spinner.html
I'm following this ^ tutorial on making a "spinner" but when I get to this code:
开发者_StackOverflow中文版Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.gender_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
I get the "cannot be resolved to a type" error on:
ArrayAdapter
I'm not sure what to do here. I've done everything exactly how they said to, but I get these errors for some reason.
Are you not missing an import?
import android.widget.ArrayAdapter;
If you are developing in Eclipse, try a shortcut: Ctrl+Shift+O, which organizes your imports
精彩评论