0

I have this weird bug going on with the Spinner, When I tap the spinner, all I see is this enter image description here

I can still select values, and they interact with the app like they're supposed to, so I guess it's white text on a white background.

After some research, I've tried changing the adapter's first argument to this instead of letterSpinner.getContext() no luck, I also tried this.getApplicationContext() and, I have even tried many different android.R.layout. values for the adapter's second argument, same white on white results.

It's weird, it was working fine before, all the editing I've been doing of this app didn't touch any of the Spinner's code, here's all my code related to the Spinner:

letters = getResources().getStringArray(R.array.letters_array);
lettersForAdapter = new ArrayList<String>(Arrays.asList(letters));

letterSpinner = (Spinner)findViewById(R.id.letterSpinner);

spinnerAdapter = new ArrayAdapter<String>(letterSpinner.getContext(),
                android.R.layout.simple_spinner_dropdown_item, lettersForAdapter);
letterSpinner.setAdapter(spinnerAdapter);

letterSpinner.setOnItemSelectedListener(new OnItemSelectedListener()
{
    @Override
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if(position == 0) //So 'Select a Letter' does nothing.
        return; //Do nothing.
    else
    {
        //Check for a match.
        checkForMatch(parent.getSelectedItem().toString());
        //Remove the letter. 
        spinnerAdapter.remove(parent.getSelectedItem().toString());
        spinnerAdapter.notifyDataSetChanged();

        //Ensures that the Spinner won't recursively call itself when an item is removed.
        letterSpinner.setSelection(0);
    }
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
    //Do nothing.
}
});

XML:

<Spinner
        android:id="@+id/letterSpinner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:entries="@array/letters_array" /> 

Any ideas as to the cause of this problem?

Jerryq27
  • 159
  • 1
  • 14
  • 1
    Check with different application theme .. – Subhalaxmi Mar 20 '15 at 08:00
  • 1
    I did some experimenting with Themes since Lollipop used a different one from KitKat, that turned out to be the problem, thank you! I would accept your answer, but I don't think I could in comment form.. – Jerryq27 Mar 28 '15 at 04:26

1 Answers1

0

Instead of letterSpinner.getContext() change to Activity.this and change the text color to black.

  • Isn't that the same as just using 'this'? Well, nonetheless I tried it and it didn't fix the issue, thanks for the suggestion, any other ideas? – Jerryq27 Mar 20 '15 at 06:01