Hi Mark, Here's what I did

My Existing Class extending ListActivity

/
*******************************************************************************************************/
public class LifeProducts extends ListActivity {

        private static List<String> products;
        private static List<String> actives;

        private DataHelper dh;
        private List<MyProducts> ips;

        public void onCreate(Bundle savedInstanceState) {

                dh = new DataHelper(this);
                ips = dh.GetMyProducts();

                products = new ArrayList<String>();
                actives = new ArrayList<String>();

                for(MyProducts ip : ips){
                        products.add(ip.name);

                        if (ip.active == 0)
                                actives.add("N");
                        else
                                actives.add("Y");
                }

                super.onCreate(savedInstanceState);

                ProductAdapter<String> pas = new ProductAdapter<String>(this,
R.layout.life_products, products);
                pas.setActiveList(actives);
                setListAdapter(pas);

                ListView lv = getListView();
                lv.setTextFilterEnabled(true);

                lv.setOnItemClickListener(
                        new OnItemClickListener() {
                                @Override
                                public void onItemClick(AdapterView<?> arg0, 
View arg1, int arg2,
                                                long arg3) {
                                        // TODO Auto-generated method stub
                                        Toast.makeText(getApplicationContext(), 
((TextView)
arg1).getText(),
                                                  Toast.LENGTH_SHORT).show();
                                }
                        }
                );
        }
}

and here's how i overloaded the ArrayAdapter
/
*******************************************************************************************************/
@SuppressWarnings({ "unchecked", "hiding" })
public class ProductAdapter<String> extends ArrayAdapter{

        public ProductAdapter(Context context, int textViewResourceId, List
objects) {
                super(context, textViewResourceId, objects);
                // TODO Auto-generated constructor stub
        }

        public List<String> actives;

        public void setActiveList(List<String> act){
                actives = act;
        }

        @Override
        public boolean areAllItemsEnabled(){
                return false;
        }

        @Override
        public boolean isEnabled(int position){
                for (String s : actives){
                        if (s == "Y")
                                return true;
                        else
                                return false;
                }
                return true;
        }
}
/
*******************************************************************************************************/
Now my Database has 8 records, which are to be displayed
I am not getting any error but the my output just contains the last
records displayed 8 times

what am i doing wrong??

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to