Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想我了解加载器应该如何工作等,但我不太确定加载器如何向 LoaderManager 或应用程序发出信号,表明它没有成功完成。做这个的最好方式是什么?
没有内置的方法。捕获所有异常,并返回一些具有可选Exception error字段的类。检查异常是否为 null 以查看调用是否成功。就像是:
Exception error
public class LoaderResult<T> { private T data; private Exception error; private LoaderResult(T data, Exception error) { this.data = data; this.error = error; } }