Example #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View myView = inflater.Inflate(Resource.Layout.storeMenu, container, false);

            listView = myView.FindViewById <ListView>(Resource.Id.myListBooks);
            mySearch = myView.FindViewById <SearchView>(Resource.Id.searchID);
            myDB     = new DBHelperClass(myContext);

            ICursor myresult = myDB.getAllBooks();

            while (myresult.MoveToNext())
            {
                myBooksList.Add(new BookObject(myresult.GetInt(myresult.GetColumnIndexOrThrow("book_id")), myresult.GetString(myresult.GetColumnIndexOrThrow("book_name")), myresult.GetString(myresult.GetColumnIndexOrThrow("book_author")), myresult.GetInt(myresult.GetColumnIndexOrThrow("book_image")), myresult.GetDouble(myresult.GetColumnIndexOrThrow("book_rate"))));
            }

            /*    myBooksList.Add(new BookObject(101,"Book 1", "Amith", Resource.Drawable.RomeoandJuliet, 3.5));
             * myBooksList.Add(new BookObject(102, "Book 2", "Prasanna", Resource.Drawable.RomeoandJuliet, 4.5));
             * myBooksList.Add(new BookObject(103, "Book 3", "Shriya", Resource.Drawable.RomeoandJuliet, 2));
             * myBooksList.Add(new BookObject(104, "Book 4", "Raul", Resource.Drawable.RomeoandJuliet, 2.5));
             * myBooksList.Add(new BookObject(105, "Book 5", "girish", Resource.Drawable.RomeoandJuliet, 3));*/


            MyCustomAdapter myAdapter = new MyCustomAdapter(myContext, myBooksList);

            listView.Adapter = myAdapter;

            listView.ItemClick       += List1_ItemClick;
            mySearch.QueryTextChange += searchUsers;

            return(myView);
        }
        public PhotoAlbum1(Activity context)
        {
            DBHelperClass myDB     = new DBHelperClass(context);
            ICursor       myresult = myDB.getAllBooks();

            listPhoto = new Photo1[myresult.Count];
            int i = 0;

            while (myresult.MoveToNext())
            {
                listPhoto[i] = new Photo1()
                {
                    mPhotoID = myresult.GetInt(myresult.GetColumnIndexOrThrow("book_image")), mCaption = myresult.GetString(myresult.GetColumnIndexOrThrow("book_name"))
                };
                ++i;
            }

            this.photos1 = listPhoto;
            random       = new Random();
        }