C
_chris
Ambitioniertes Mitglied
- 3
EDIT: Es geht. Habe vor einer ID ein "android:" gelöscht, warum auch immer. Dieser View verdeckte dann alles - nix für ungut. Habs unten korrigiert, es läuft so - vlt hilfts ja noch jemandem.
Hallo zusammen,
folgende Problematik: Ich möchte eine ListActivity nutzen, der Cursor enthält Datensätze, jedoch bleibt die Liste leer. Blöderweise kommt aber kein Fehler der mir helfen würde. Ich schätze mal mit dem Mapping der Daten stimmt was nicht - allerdings weiß ich nicht wie es anders gehen sollte.
Die ListActivity:
Das Hauptlayout:
Die einzelnen Items:
Ist hier irgendwie ein Fehler bei den IDs!? Hoffe mir kann hier jemand helfen.
Gruß
Chris
Hallo zusammen,
folgende Problematik: Ich möchte eine ListActivity nutzen, der Cursor enthält Datensätze, jedoch bleibt die Liste leer. Blöderweise kommt aber kein Fehler der mir helfen würde. Ich schätze mal mit dem Mapping der Daten stimmt was nicht - allerdings weiß ich nicht wie es anders gehen sollte.
Die ListActivity:
Code:
Cursor result = db.rawQuery("SELECT _id, description...", null);
Log.d("WD", "Results: "+result.getCount()); // Ist > 0
startManagingCursor(result);
ListAdapter adapter = new SimpleCursorAdapter(
this,
R.layout.lesson_item,
result,
new String[] {"starttime", "description"},
new int[] {R.id.time, R.id.description});
setListAdapter(adapter);
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
<TextView android:id="@id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:color="#FFFFFF"
android:text="Kein Eintrag"/>
</LinearLayout>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/time"
android:textSize="12sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/description"
android:textSize="16sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Gruß
Chris
Zuletzt bearbeitet: