How does generic ListAdapter works?
<p>I am newbie. I'm sorry if i ask ridiculous question.</p>

<p>I want to have generic Adapter class implements <code>ListAdapter</code> . And I have to override some functions of it like <code>getView</code> .</p>

<p>getView function is i think the most important part and it is calling when it is rendering (like asp.net (I think)).</p>

<p>I have written some code in the simplest level below:</p>

<pre><code>package com.yeni.listAdapter;

import android.app.ListActivity;
import android.os.Bundle;

public class baslangicAktivitesi extends ListActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        setListAdapter(new NewAdapter(this));
    }
}
</code></pre>

<p>And this is my generic ListAdapter class:</p>

<pre><code>package com.yeni.listAdapter;

import android.content.Context;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TextView;

public class NewAdapter implements ListAdapter {
    private Context ctx;

    public NewAdapter(Context _ctx) {
        super();
        ctx = _ctx;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public Object getItem(int arg0) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public long getItemId(int arg0) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public int getItemViewType(int arg0) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TextView tv = new TextView(ctx);
        tv.setText("This text will be shown");

        LinearLayout lila = new LinearLayout(ctx);
        lila.addView(tv,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));

        return lila;
    }

    @Override
    public int getViewTypeCount() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public boolean hasStableIds() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public boolean isEmpty() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public void registerDataSetObserver(DataSetObserver observer) {
        // TODO Auto-generated method stub

    }

    @Override
    public void unregisterDataSetObserver(DataSetObserver observer) {
        // TODO Auto-generated method stub

    }

    @Override
    public boolean areAllItemsEnabled() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public boolean isEnabled(int position) {
        // TODO Auto-generated method stub
        return false;
    }
}
</code></pre>

<p>The thing that i am wondering is how is the mechanism of ListAdapter and if i want to write template with xml in (i think it will be) <code>res-&gt;layout</code> how it should be (composite view that i want to write something ImageView and TextView?</p>

<p>Thank you very very much...</p>
