android arrayadapter populated, but shows blanks

70 Views Asked by At

Like I said, the array adapter contains all the correct strings, but when they show on my page, they are just blank.

When I click on the boxes under the AutoCompleteTextView, they auto fill the correct values too. Why is this? Is there some weird thing that causes them to be shown too far right or left and they are off screen?

Where I set the adapter in onCreate:

groupNameInput = (AutoCompleteTextView) findViewById(R.id.groupNameInput);
    yourNameInput = (EditText) findViewById(R.id.yourNameInput);
    sp = PreferenceManager.getDefaultSharedPreferences(this);
    ArrayAdapter<String> adapter = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, new ArrayList<>(sp.getAll().keySet()));
    groupNameInput.setAdapter(adapter);
    for(int x = 0; x < adapter.getCount(); x++){
        //Shows the right strings
        Log.d("test", adapter.getItem(x));
    }

The entire layout file (because layouts are generally stupid and screw things up:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="nuffsaidm8.me.assignme.activities.GroupLogin">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/gn"
    android:id="@+id/textView5"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="@string/yn"
    android:id="@+id/textView6"
    android:layout_below="@+id/groupNameInput"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginTop="20dp" />

<AutoCompleteTextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/groupNameInput"
    android:layout_below="@+id/textView5"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:hint="@string/acfkg" />

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/yourNameInput"
    android:layout_below="@+id/textView6"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/litg"
    android:id="@+id/logInButton"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:onClick="tryLogIn"/>

<ImageButton
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:id="@+id/homeLogin"
    android:layout_below="@+id/logInButton"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="30dp"
    android:background="@drawable/homeicon"
    android:onClick="goHome"/>
</RelativeLayout>

EDIT: I've noticed that elsewhere in my project, more specifically a programatically created edittext for an alert dialog, the text is not visible. Could it be for both that the text is white? If so, how can I fix that?

0

There are 0 best solutions below