Korrekte Verwendung von setEmtpyView in AdapterView

Ich habe wirklich Probleme mit der setEmptyView-Methode. Ich habe versucht, es in GridView und ListView zu implementieren, aber beide haben nicht funktioniert. Hier ein Beispiel für einen Codeblock:

 networkGames = (GridView) baseLayer.findViewById(R.id.all_game_grid_network);
 networkGames.setBackgroundResource(R.drawable.game_border);
 networkGames.setSelector(R.drawable.game_active_border);
 networkGames.setOnItemClickListener(new NetworkGameListener());
 networkGames.setEmptyView(View.inflate(baseLayer, R.drawable.no_network_games, null));
 networkGames.setAdapter(new NetworkAdapter());

Der Netzwerkadapter enthält keine Elemente:

private class NetworkAdapter extends BaseAdapter {

        /* (non-Javadoc)
         * @see android.widget.Adapter#getCount()
         */
        @Override
        public int getCount() {
            return 0;
        }

        /* (non-Javadoc)
         * @see android.widget.Adapter#getItem(int)
         */
        @Override
        public Object getItem(int position) {
            return null;
        }

        /* (non-Javadoc)
         * @see android.widget.Adapter#getItemId(int)
         */
        @Override
        public long getItemId(int position) {
            return 0;
        }

        /* (non-Javadoc)
         * @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
         */
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            return null;
        }

    }

Ich habe auch versucht, networkGames.setAdapter (null) aufzurufen, aber dies funktioniert auch nicht. Mein emtpyView sieht so aus:

<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
    <TextView
    android:text="There are currently no network games available. Start a new one."
    android:id="@+id/TextView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center">
    </TextView>
</LinearLayout>

Ich weiß wirklich nicht, was ich falsch mache. Ich habe auch verschiedene Tutorials gelesen, aber keines hatte Probleme.

Antworten auf die Frage(10)

Ihre Antwort auf die Frage