lundi 23 novembre 2015

how to save listview item as a highlighted item

Below is a screenshot of a listview with sample content from sqlite db, how can i save a listview item as a highlighted item when i tap the highlight button on the right? so everytime i open it, the saved highlighted item is automatically highlighted

enter image description here

my layout xml

<ListView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/listView2"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_above="@+id/seekBar2" />

<SeekBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/seekBar2"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignRight="@+id/listView2"
    android:layout_alignEnd="@+id/listView2" />

<ImageButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageButton9"
    android:layout_marginTop="176dp"
    android:src="@drawable/m1"
    android:layout_weight="3"
    android:scaleType="fitCenter"
    android:background="@android:color/transparent"
    android:layout_alignTop="@+id/listView2"
    android:layout_alignRight="@+id/listView2"
    android:layout_alignEnd="@+id/listView2"
    android:visibility="invisible" />

<ImageButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageButton10"
    android:src="@drawable/m2"
    android:layout_weight="3"
    android:scaleType="fitCenter"
    android:background="@android:color/transparent"
    android:layout_below="@+id/imageButton9"
    android:layout_alignRight="@+id/listView2"
    android:layout_alignEnd="@+id/listView2"
    android:visibility="invisible" />

<ImageButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageButton11"
    android:src="@drawable/m3"
    android:layout_weight="3"
    android:scaleType="fitCenter"
    android:background="@android:color/transparent"
    android:layout_below="@+id/imageButton10"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:visibility="invisible" />

Aucun commentaire:

Enregistrer un commentaire