本文整理汇总了Java中com.activeandroid.ActiveAndroid.getDatabase方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveAndroid.getDatabase方法的具体用法?Java ActiveAndroid.getDatabase怎么用?Java ActiveAndroid.getDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.activeandroid.ActiveAndroid
的用法示例。
在下文中一共展示了ActiveAndroid.getDatabase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCartCount
import com.activeandroid.ActiveAndroid; //导入方法依赖的package包/类
public synchronized int getCartCount() {
SQLiteDatabase db = ActiveAndroid.getDatabase();
if (db == null)
return 0;
String sql = "SELECT total(count) FROM Cart WHERE orderId IS NULL";
Cursor cursor = db.rawQuery(sql, null);
if (cursor == null)
return 0;
if (!cursor.isFirst())
cursor.moveToFirst();
int count = cursor.getInt(0);
cursor.close();
return count;
}
示例2: setupGrid
import com.activeandroid.ActiveAndroid; //导入方法依赖的package包/类
private void setupGrid() {
SQLiteDatabase db = ActiveAndroid.getDatabase();
Cursor cursor = db.query(ToasterModel.TABLE_NAME, null, null, null, null, null, null);
ToasterAdapter adapter = new ToasterAdapter(this, cursor,
R.layout.grid_item, R.integer.num_columns, R.dimen.grid_spacing, R.dimen.grid_spacing);
View headerView = LayoutInflater.from(this).inflate(R.layout.view_header, null, false);
View footerView = LayoutInflater.from(this).inflate(R.layout.view_footer, null, false);
multiColumnList = (ListView) findViewById(R.id.multiColumnList);
multiColumnList.addHeaderView(headerView);
multiColumnList.addFooterView(footerView);
multiColumnList.setAdapter(adapter);
}
示例3: onCreateLoader
import com.activeandroid.ActiveAndroid; //导入方法依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
String orderBy = Todo.COLUMN_ADD_DATE + " DESC";
return new TodoLoader(
mFragment.getActivity(),
ActiveAndroid.getDatabase(),
Todo.TABLENAME,
null,
Todo.COLUMN_STATUS + "!=?",
new String[] { Integer.toString(TodoDaoHelper.STATUS_ARCHIVE) },
orderBy);
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:14,代码来源:TodoCursorAdapter.java
示例4: onCreateLoader
import com.activeandroid.ActiveAndroid; //导入方法依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
String endDateColumn = Todo.COLUMN_END_DATE;
String orderBy = endDateColumn + " DESC";
return new TodoLoader(
mFragment.getActivity(),
ActiveAndroid.getDatabase(),
Todo.TABLENAME,
null,
Todo.COLUMN_STATUS + "=?",
new String[] { Integer.toString(TodoDaoHelper.STATUS_ARCHIVE) },
orderBy);
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:14,代码来源:HistoryCursorAdapter.java