EfficientAdapter and grabbing text of item clicked
<p>For EfficientAdapter What code I need to use under onListItemClick to get text of selected item?
I tried:</p>

<pre><code>str=(String) ((TextView)l.getItemAtPosition(position)).getText()
</code></pre>

<p>But this only brings CastException, since it fetches the LinearLayout view holding the textview and imageview (see code <a href="http://developer.android.com/intl/de/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html" rel="nofollow">here</a>)</p>

<p>Please help!</p>

<p>Some of the code:</p>

<pre><code>public class Bookmarks extends ListActivity {
public static Typeface mFace;
public EfficientAdapter eff;

private static class EfficientAdapter extends BaseAdapter {
    private LayoutInflater mInflater;

    public EfficientAdapter(Context context) {
        mInflater = LayoutInflater.from(context);
    }

    public int getCount() {
        return DAT.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.list_item_text, null);
            holder = new ViewHolder();
            holder.text = (TextView) convertView.findViewById(R.id.text);
            holder.text.setTypeface(mFace);

            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.text.setText(DAT[position]);

        return convertView;
    }

    static class ViewHolder {
        TextView text;
    }
}

public Object getItem(int position) { 
    return position; 
}

public void onResume(Bundle icicle) {
    eff.notifyDataSetChanged();
}

protected void onListItemClick(ListView l, View v, int position, long id) {
    //////////CRASHES on next line!!!!!!!!!!!!!!!!!!
TextView tv = (TextView) l.getItemAtPosition(position);
    String str = tv.getText().toString();

}


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    eff = (new EfficientAdapter(this));
    setListAdapter(eff);
    registerForContextMenu(getListView());
}
</code></pre>

<p>}</p>
