Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
接收同步进度信息。
public interface SyncObserver
SyncObserver 接口的所有成员,包括所有继承的成员。
syncProgress 方法
要在同步期间接收进度报告,您必须创建一个执行该任务的新类,并使用 SyncParms.setSyncObserver 方法实现此类。
下面的示例说明了一个简单的 SyncObserver:
class MyObserver implements SyncObserver { public boolean syncProgress(int state, SyncResult result) { System.out.println( "sync progress state = " + state + " bytes sent = " + result.getSentByteCount() + " bytes received = " + result.getReceivedByteCount() ); return false; // Always continue synchronization. } public MyObserver() {} // The default constructor. }
按如下方法启用上面的观察器类:
SyncParms.setSyncObserver(new MyObserver());