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


Java DateUtils类代码示例

本文整理汇总了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();
	}
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:18,代码来源:PreferencesActivity.java

示例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.");
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:80,代码来源:DbAdapter.java


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