问题
I'm developing an android application for a store, which provides many functions. One of these is a function that allows the customer to search a product with some criteria (price,size,type... like in the picture ).
I guess I should work with SqliteDatabase
, but I have no idea how I can make this multi-criteria search interface , so the user can query the database.

回答1:
It's simple. after setup your database, you can use SQL queries and JOIN types with WHERE critaria and finally achive proper data, use Cursor class to iterate through results.
see: http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html
http://www.w3schools.com/sql/sql_where.asp
http://www.w3schools.com/sql/sql_and_or.asp
http://www.w3schools.com/sql/sql_join_inner.asp
回答2:
Before handling it, you should design your database properly. Suppose, List of tables -
1) product_type(_id<should be primary key to link another table>,
type_id<integer>, type_name<text>
2) product_price(_id<should be primary key to link another table>,
type_id<integer>, price<double>
3) product_type_size(_id<should be primary key to link another table>, type_id<integer>, size<text>
And create views as your requirement - product_search(join your table properly) And run your queries as requirement and match with the value of the view.
Go ahead--
来源:https://stackoverflow.com/questions/9861156/sqlite-advanced-search