/** Ask the user the file to import to bookmarks and history, and launch the import. */ private void importHistoryBookmarks() { List<String> exportedFiles = IOUtils.getExportedBookmarksFileList(); final String[] choices = exportedFiles.toArray(new String[exportedFiles.size()]); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setInverseBackgroundForced(true); builder.setIcon(android.R.drawable.ic_dialog_info); builder.setTitle(getResources().getString(R.string.Commons_ImportHistoryBookmarksSource)); builder.setSingleChoiceItems( choices, 0, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { doImportHistoryBookmarks(choices[which]); dialog.dismiss(); } }); builder.setCancelable(true); builder.setNegativeButton(R.string.Commons_Cancel, null); AlertDialog alert = builder.create(); alert.show(); }
/** 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, IOUtils.getNowForFileName() + ".xml", BookmarksHistoryController.getInstance().getAllRecords(this), mProgressDialog); new Thread(exporter).start(); } }