赞
踩
APP A通过Provider的方式向其他应用如APP B提供数据,如果APP B需要调用APP A中的方法,则Provider必须重写call方法,APP B通过调用call方法会执行APP A中Provider的call方法,B中调用call方法的返回值就是Provider中call方法的返回值。
APP A的Provider必须重写call方法:
- public class ContentProviderDemo extends ContentProvider {
-
- @Override
- public Bundle call(String method, String arg, Bundle extras) {
- System.out.println("method:" + method);
- Bundle bundle = new Bundle();
- // put一个boolean值,如果执行方法成功返回true、失败返回fasle
- bundle.putBoolean(method, true);
- return bundle;
- }
-
- ...
-
- }
APP B调用call方法:
- String method = "isSuccess";
- String uri = "content://jobdispatcher/abc.txt";
- Bundle
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。