create listview programmatically with no xml layout
<p>I found this example to create a custom listview:</p>

<pre><code>public class UsersListActivity extends ListActivity{    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);         
            String[] statesList = {"listItem 1", "listItem 2", "listItem 3"};
            setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item,
                    statesList)); 
            ListView lv = getListView(); 

            lv.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                        int position, long id) {


                     Toast.makeText(getApplicationContext(),
                     "You selected : "+((TextView) view).getText(), Toast.LENGTH_SHORT).show();
     }
            });

        }

}
</code></pre>

<p>However, they are using a xml layout for each row. Is this good practice? What if I wanted to create my own layout programmatically and utilize it in the adapter? </p>

<p>I guess it would be easier just to use the xml layout, but it would be nice to know</p>
