本文整理匯總了Java中org.zirco.utils.DateUtils類的典型用法代碼示例。如果您正苦於以下問題:Java DateUtils類的具體用法?Java DateUtils怎麽用?Java DateUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DateUtils類屬於org.zirco.utils包,在下文中一共展示了DateUtils類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doExportHistoryBookmarks
import org.zirco.utils.DateUtils; //導入依賴的package包/類
/**
* Export the bookmarks and history.
*/
private void doExportHistoryBookmarks() {
if (ApplicationUtils.checkCardState(this, true)) {
mProgressDialog = ProgressDialog.show(this,
this.getResources().getString(R.string.Commons_PleaseWait),
this.getResources().getString(R.string.Commons_ExportingHistoryBookmarks));
XmlHistoryBookmarksExporter exporter = new XmlHistoryBookmarksExporter(this,
DateUtils.getNowForFileName() + ".xml",
BookmarksProviderWrapper.getAllStockRecords(this.getContentResolver()),
mProgressDialog);
new Thread(exporter).start();
}
}
示例2: exportOldBookmarks
import org.zirco.utils.DateUtils; //導入依賴的package包/類
/**
* Export bookmarks from the old database. Transform the query result
* into a MatrixCursor following the stock bookmarks database, so it
* can be exported with the XmlHistoryBookmarksExporter without any
* change on it.
* @param db The database.
*/
private void exportOldBookmarks(SQLiteDatabase db) {
Log.i("DbAdapter", "Start export of old bookmarks.");
try {
if (ApplicationUtils.checkCardState(mParent.mContext, false)) {
Log.i("DbAdapter", "Export of old bookmarks: SDCard checked.");
MatrixCursor cursor = null;
Cursor c = db.query( "BOOKMARKS",
new String[] { "_id",
"title",
"url",
"creation_date",
"count" },
null,
null,
null,
null,
null);
if (c != null) {
if (c.moveToFirst()) {
cursor = new MatrixCursor(new String[] {
Browser.BookmarkColumns.TITLE,
Browser.BookmarkColumns.URL,
Browser.BookmarkColumns.VISITS,
Browser.BookmarkColumns.DATE,
Browser.BookmarkColumns.CREATED,
Browser.BookmarkColumns.BOOKMARK
});
int titleColumn = c.getColumnIndex("title");
int urlColumn = c.getColumnIndex("url");
int creationDateColumn = c.getColumnIndex("creation_date");
int countColumn = c.getColumnIndex("count");
while (!c.isAfterLast()) {
Date date = DateUtils.convertFromDatabase(mParent.mContext, c.getString(creationDateColumn));
Object[] data = new Object[6];
data[0] = c.getString(titleColumn);
data[1] = c.getString(urlColumn);
data[2] = c.getInt(countColumn);
data[3] = date.getTime();
data[4] = date.getTime();
data[5] = 1;
cursor.addRow(data);
c.moveToNext();
}
}
c.close();
}
if (cursor != null) {
Log.i("DbAdapter", "Export of old bookmarks: Writing file.");
new Thread(new XmlHistoryBookmarksExporter(null, "auto-export.xml", cursor, null)).start();
}
}
} catch (Exception e) {
Log.i("DbAdapter", "Export of old bookmarks failed: " + e.getMessage());
}
Log.i("DbAdapter", "End of export of old bookmarks.");
}