本文整理汇总了Java中org.zirco.ui.runnables.XmlHistoryBookmarksExporter类的典型用法代码示例。如果您正苦于以下问题:Java XmlHistoryBookmarksExporter类的具体用法?Java XmlHistoryBookmarksExporter怎么用?Java XmlHistoryBookmarksExporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlHistoryBookmarksExporter类属于org.zirco.ui.runnables包,在下文中一共展示了XmlHistoryBookmarksExporter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExportHistoryBookmarks
import org.zirco.ui.runnables.XmlHistoryBookmarksExporter; //导入依赖的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.ui.runnables.XmlHistoryBookmarksExporter; //导入依赖的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.");
}