本文整理匯總了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