android Xml-List view with filter
<p>android is new for me.
I am trying to develop a program on 1.5 platform but still in progress, plz guide me.</p>

<p>I have some information in following format</p>

<pre><code>"item1","description1"
"item2","description2"
"item3","description3"
"item4","description4"
.
.
.
.
</code></pre>

<p>I want to show them on screen, I dont know which is recommended way to do this.  After google I found 2 method. but I failed to successfully implement any of one.</p>

<p><strong>Method 1</strong></p>

<p>I break both columns data into 2 different arrays, then populate
listactivity with array of column 1, enable filter &amp; on clicked event I want to raise alert which should show Text clicked in tilte &amp; desc from 2nd array as msg body based on position.
But here is problem if using filter index becomes reinitialize :-(, and there didnot find another way to get text of that row.</p>

<p><hr></p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //setContentView(R.layout.main);

   setListAdapter(new ArrayAdapter&lt;String&gt;(this, 
                               android.R.layout.simple_list_item_1, Names));    
   getListView().setTextFilterEnabled(true);

}
</code></pre>

<p><hr></p>

<pre><code>public void onListItemClick(ListView parent, View v, int position, long id) {

    Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(Names[position]); 
    builder.setMessage(description[position] + " -&gt; " + position );
    builder.setPositiveButton("ok", null);
    builder.show();
}
</code></pre>

<p><hr></p>

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

<p><hr></p>

<p>its not picking right item from position if filter used :-(, plz guide
Can you share source code of this</p>

<p><strong>Method B</strong></p>

<p>Here I tried to generate list row from XML , but giving error that 1.5 jar file didnot allow modification :-(</p>

<p><hr></p>

<pre><code>    public View getView(int position, View convertView, ViewGroup parent) {

            /*       
            ViewInflate inflater=context.getViewInflate();
            View row=inflater.inflate(R.layout.row, null, null);
            */

            View row = (View) convertView;

            if (row==null) {
                LayoutInflater  inflater=context.getLayoutInflater();
            //    LayoutInflater inflater = (LayoutInflater)  context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
                  row = inflater.inflate(R.layout.row,null);
            }

            TextView label=(TextView)row.findViewById(R.id.label);
            label.setText(items[position]);

            TextView description=(TextView)row.findViewById(R.id.description);
            description.setText(items[position]);

            //    ImageView icon=(ImageView)row.findViewById(R.id.icon);
            //    icon.setImageResource(R.drawable.delete);


            return(row);
        }
</code></pre>

<p><hr></p>

<p>Plz suggest what is a right way to acconplish this, so app can show desc of item , has filter too. Plz share If you have any shouce code for this</p>
