当前位置: 首页>>代码示例>>Java>>正文


Java DataSupport.findAll方法代码示例

本文整理汇总了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");
    }
}
 
开发者ID:qiaopeichen,项目名称:jojoweather,代码行数:21,代码来源:chooseAreaFragment.java

示例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");
    }
}
 
开发者ID:Qinlong275,项目名称:AndroidBookTest,代码行数:21,代码来源:ChooseAreaFragment.java

示例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");
    }
}
 
开发者ID:JakeLes,项目名称:myCoolWeather,代码行数:22,代码来源:ChooseAreaFragment.java

示例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");
    }
}
 
开发者ID:kipmin,项目名称:KipminWeather,代码行数:18,代码来源:ChooseAreaFragment.java

示例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);
        }
    }
}
 
开发者ID:wendyltan,项目名称:EasyTodo,代码行数:21,代码来源:AlarmReceiver.java

示例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");
    }
}
 
开发者ID:zjutcmos,项目名称:HappyWeather,代码行数:21,代码来源:ChooseAreaFragment.java

示例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");
    }
}
 
开发者ID:mzhkby,项目名称:coolweater,代码行数:21,代码来源:ChooseAreaFragment.java

示例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");
    }
}
 
开发者ID:smartbeng,项目名称:YunPengWeather,代码行数:21,代码来源:ChooseAreaFragment.java

示例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()) ;
        }
    });
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:12,代码来源:PillBoxAdapter.java

示例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);
}
 
开发者ID:zhaoweihaoChina,项目名称:MrTranslator,代码行数:10,代码来源:CollectionActivity.java

示例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();
}
 
开发者ID:ChenTianSaber,项目名称:DailyZhiHu,代码行数:10,代码来源:DownloadFragment.java

示例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;
}
 
开发者ID:monkeywiiu,项目名称:Discover,代码行数:10,代码来源:LitePalUtil.java

示例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();
}
 
开发者ID:yuhodev,项目名称:login,代码行数:29,代码来源:Index.java

示例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();
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:49,代码来源:QueryBasicTest.java

示例15: getGroups

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized List<Groups> getGroups() {
    return DataSupport.findAll(Groups.class);
}
 
开发者ID:GitLqr,项目名称:LQRWeChat,代码行数:4,代码来源:DBManager.java


注:本文中的org.litepal.crud.DataSupport.findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。