lundi 2 mai 2016

Why i get 0? must be a word

enter image description here

Why checkbox has 0? There must be string "Avatar" from string resourse. I need help. Here's my code.................. ................................ ................................

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="10dp">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:src="@drawable/no_avatar"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="jjjjj"
        android:id="@+id/name"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginStart="19dp"
        android:layout_marginTop="13dp"
        android:layout_alignParentTop="true"
        android:layout_toEndOf="@+id/imageView"
        android:layout_toRightOf="@id/imageView"
        android:clickable="false"
        android:textSize="20sp" />
    <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/checkbox"
        android:id="@+id/checkBox"
        android:height="0dp"
        android:clickable="true"
        android:checked="false"
        android:layout_gravity="right"
        android:layout_alignParentTop="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_marginEnd="9dp"
        android:layout_marginRight="9dp"/>
</RelativeLayout>

Fill ListView from SQLite

try{
        SQLiteOpenHelper databaseHelper = new DatabaseHelper(v.getContext());
        db = databaseHelper.getWritableDatabase();
        Cursor cursor = db.query("PEOPLE", new String[] {"_id", "NAME", "CHECKBOX"}, null, null, null, null, null);
        CursorAdapter listAdapter = new SimpleCursorAdapter(v.getContext(), R.layout.list_item, cursor, new String[]{"NAME", "CHECKBOX"}, new int[]{R.id.name, R.id.checkBox}, 0);
        listView.setAdapter(listAdapter);
    } catch (SQLiteException e){
        Toast.makeText(v.getContext(), "База данных недоступна", Toast.LENGTH_SHORT).show();
        }

Aucun commentaire:

Enregistrer un commentaire