本文整理匯總了Java中org.litepal.crud.DataSupport.findAll方法的典型用法代碼示例。如果您正苦於以下問題:Java DataSupport.findAll方法的具體用法?Java DataSupport.findAll怎麽用?Java DataSupport.findAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.litepal.crud.DataSupport
的用法示例。
在下文中一共展示了DataSupport.findAll方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: queryProvinces
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
/**
* 查詢全國所有的省,優先從數據庫查詢,如果沒有查詢到再去服務器上查詢
*/
private void queryProvinces() {
titleText.setText("中國");
backButton.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if (provinceList.size() > 0) {
dataList.clear();
for (Province province : provinceList) {
dataList.add(province.getProvinceName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = LEVEL_PROVINCE;
} else {
String address = "http://guolin.tech/api/china";
queryFromServer(address, "province");
}
}
示例2: queryProvinces
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
/**
* 查詢全國所有的省,優先從數據庫查詢,如果沒有查詢到再去服務器上查詢
*/
private void queryProvinces(){
titleText.setText("中國");
backButton.setVisibility(View.GONE);
provinceList= DataSupport.findAll(Province.class);
if (provinceList.size()>0){
dataList.clear();
for (Province province:provinceList) {
dataList.add(province.getProvinceName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel=LEVEL_PROVINCE;
}else {
String address="http://guolin.tech/api/china";
queryFromServer(address,"province");
}
}
示例3: queryProvinces
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
/**
* 查詢全國所有的省
*/
private void queryProvinces() {
titleText.setText("中國");
backButton.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if(provinceList.size() >0){
dataList.clear();
for (Province province:provinceList){
dataList.add(province.getProvinceName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel =LEVEL_PROVINCE;
}else {
String address ="http://guolin.tech/api/china";
queryFromServer(address,"province");
}
}
示例4: queryProvinces
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
private void queryProvinces() {
titleText.setText("中國");
button.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if (provinceList.size() > 0) {
dataList.clear();
for (Province province : provinceList) {
dataList.add(province.getCnProvince());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = OWN_LEVEL_PROVINCE;
} else {
String address = "https://www.kipmin.cc/h/cityList.json";
queryFromServer(address, "province");
}
}
示例5: setTodayEvent
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
private void setTodayEvent(){
List<TodoEvent> todoEventList = DataSupport.findAll(TodoEvent.class);
Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
int day = c.get(Calendar.DAY_OF_MONTH);
StringBuilder builder;
if (day<10){
builder = new StringBuilder().append(year+"年"+month+"月"+"0"+day+"日");
}else{
builder = new StringBuilder().append(year+"年"+month+"月"+day+"日");
}
String dayString = builder.toString();
for (TodoEvent event : todoEventList) {
if (event.getEventDate().equals(dayString)) {
tempList.add(event);
}
}
}
示例6: queryProvinces
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
/**
* 查詢全國所有的省,優先從數據庫查詢,如果沒有查詢到再去服務器上查詢。
*/
private void queryProvinces() {
titleText.setText("中國");
backButton.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if (provinceList.size() > 0) {
dataList.clear();
for (Province province : provinceList) {
dataList.add(province.getProvinceName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = LEVEL_PROVINCE;
} else {
String address = "http://guolin.tech/api/china";
queryFromServer(address, "province");
}
}
示例7: queryProvinces
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
/**
* 查詢全國所有的省份,優先從數據庫查詢,如果沒有查詢到再去服務器上查詢
*/
private void queryProvinces(){
titleText.setText("中國");
backButton.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if(provinceList.size()>0){
dataList.clear();
for (Province province:provinceList){
dataList.add(province.getProvinceName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = LEVEL_PROVINCE;
}else{
String address = "http://guolin.tech/api/china";
queryFromServer(address,"province");
}
}
示例8: queryProvinces
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
/**
* 查詢全國所有的省,優先從數據庫查詢,如果沒有查詢到再去服務區上查詢
*/
private void queryProvinces() {
titleText.setText("中國");
backButton.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if (provinceList.size() > 0){
dataList.clear();
for (Province province : provinceList) {
dataList.add(province.getProvinceName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = LEVEL_PROVINCE;
}else{
String address = "http://guolin.tech/api/china";
queryFromServer(address,"province");
}
}
示例9: PillBoxAdapter
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
public PillBoxAdapter(Context context) {
this.medicines = DataSupport.findAll(Medicine.class);
this.context = context;
Collections.sort(medicines, new Comparator<Medicine>() {
@Override
public int compare(Medicine o1, Medicine o2) {
return o1.getName().compareTo(o2.getName()) ;
}
});
}
示例10: initViews
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
public void initViews(){
List<Collect> collects= DataSupport.findAll(Collect.class);
recyclerView= (RecyclerView) findViewById(R.id.recycler_view);
LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
recyclerView.setLayoutManager(linearLayoutManager);
CollectionAdapter collectionAdapter=new CollectionAdapter(this,collects);
recyclerView.addItemDecoration(new MyItemDecoration());
recyclerView.setAdapter(collectionAdapter);
}
示例11: fillContent
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
private void fillContent() {
List<Artical> allArticals = DataSupport.findAll(Artical.class);
for (Artical a:allArticals){
titleData.add(a.getArticalTitle());
bodyData.add(a.getArticalBody());
}
contentAdapter.notifyDataSetChanged();
}
示例12: getSelectLabel
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
public static List<String> getSelectLabel() {
List<LabelType> list = DataSupport.findAll(LabelType.class);
List<String> labelList = new ArrayList();
for (LabelType labelType : list) {
labelList.add(labelType.getType());
}
return labelList;
}
示例13: onResume
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
@Override
protected void onResume() {
super.onResume();
List<User> users = DataSupport.findAll(User.class);
String starRoutes = users.get(user.getId() - 1).getStarRoutes();
// 去除前綴 ,
boolean key = false;
String ID = "";
for (int i = 0; i < starRoutes.length(); i++) {
if(starRoutes.charAt(i) >= '0' && starRoutes.charAt(i) <= '9') {
key = true;
}
if (key) {
ID += starRoutes.charAt(i);
}
}
// 更新用戶
User tmp = new User();
tmp.setStarRoutes(ID);
tmp.update(user.getId());
user = DataSupport.find(User.class, user.getId());
loadAllRoutes();
}
示例14: testFindMul
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
public void testFindMul() {
short isbn1 = 30017;
Book book1 = new Book();
book1.setArea(1.5f);
book1.setBookName("Android Second Line");
book1.setIsbn(isbn1);
book1.setLevel('B');
book1.setPages(434);
book1.setPrice(40.99);
book1.setPublished(true);
book1.save();
short isbn2 = 30014;
Book book2 = new Book();
book2.setArea(8.8f);
book2.setBookName("Android Third Line");
book2.setIsbn(isbn2);
book2.setLevel('C');
book2.setPages(411);
book2.setPrice(35.99);
book2.setPublished(false);
book2.save();
List<Book> bookList = DataSupport.findAll(Book.class, book1.getId(), book2.getId());
assertEquals(2, bookList.size());
for (Book book : bookList) {
if (book.getId() == book1.getId()) {
assertEquals(1.5f, book.getArea());
assertEquals("Android Second Line", book.getBookName());
assertEquals(isbn1, book.getIsbn());
assertEquals('B', book.getLevel());
assertTrue(434 == book.getPages());
assertEquals(40.99, book.getPrice());
assertTrue(book.isPublished());
assertTrue(book.isSaved());
continue;
} else if (book.getId() == book2.getId()) {
assertEquals(8.8f, book.getArea());
assertEquals("Android Third Line", book.getBookName());
assertEquals(isbn2, book.getIsbn());
assertEquals('C', book.getLevel());
assertTrue(411 == book.getPages());
assertEquals(35.99, book.getPrice());
assertFalse(book.isPublished());
assertTrue(book.isSaved());
continue;
}
fail();
}
}
示例15: getGroups
import org.litepal.crud.DataSupport; //導入方法依賴的package包/類
public synchronized List<Groups> getGroups() {
return DataSupport.findAll(Groups.class);
}