本文整理汇总了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);
}