android: connect custom list to database
<p>i have this code for custom list.</p>

<p><strong>the my_list.xml:</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"&gt;

     &lt;TextView android:id="@+id/text1"
         android:textSize="16px"
         android:textStyle="bold"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"/&gt;

     &lt;TextView android:id="@+id/text2"
         android:textSize="12px"
         android:textStyle="italic"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"/&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p><strong>and the activity:</strong></p>

<pre><code>public class ZcustListActivity extends ListActivity {


//db Work
SQLiteDatabase db;
String SQL;
ArrayList&lt;String&gt; db_results=null;


    private SimpleAdapter notes;

    ArrayList&lt;HashMap&lt;String,String&gt;&gt; list = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    //db Work
    this.db = this.openOrCreateDatabase("DEMO", MODE_PRIVATE, null);
    this.db.execSQL("CREATE TABLE IF NOT EXISTS MEN(A VARCHAR,B VARCHAR,C VARCHAR);");
    this.db.execSQL("delete from MEN;");
    db.execSQL("INSERT INTO MEN(A,B,C) VALUES('AA1','BB1','CC1');");
    db.execSQL("INSERT INTO MEN(A,B,C) VALUES('DD2','EE2','FF2');");


        notes = new SimpleAdapter(
                this, 
                list,
                R.layout.my_list,
                new String[] { "line1","line2" },
                new int[] { R.id.text1, R.id.text2 }  );
       setListAdapter( notes );

      HashMap&lt;String,String&gt; item = new HashMap&lt;String,String&gt;();
      item.put( "line1","i am row 1" );
      item.put( "line2","i am row 2" );
      list.add( item );
       notes.notifyDataSetChanged();
    }
}
</code></pre>

<p><strong>i add my database work - but how to combine this ?</strong></p>

<p>i'am new on android and it dont work for me...... </p>
