【发布时间】:2023-04-04 16:03:01
【问题描述】:
我开发了一个备份应用程序。现在,它可以为contacts, settings and browser 进行备份,我将通过该主机进行这些备份,例如
Backup bu = new Backup(this);
bu.runBackup(Contacts.People.CONTENT_URI);
bu.runBackup(Settings.System.CONTENT_URI);
bu.runBackup(Browser.SEARCHES_URI);
我在 Backup 类中使用了 gethost 方法,例如
int count=0;
String file = uri.getHost() +"-"+ System.currentTimeMillis();
Cursor cursor = cr.query(uri, null, null, null, null);
count = cursorToCSV(cursor, file);
cursor.close();
String msg = String.format("Backed up %d records to %s file", count, file);
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
return count;
我想备份媒体文件images, videos, musics 可以这样做吗?我该怎么做?任何人都知道意思告诉我其他方式是什么?
【问题讨论】: