- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
android中AIDL创建例子
一、创建AIDL文件ackage .android123;引入声明import .android123.IAtmService;// 声明一个接口,这里演示的是银行ATM程序interface IBankAccountService {int getAccountBalance(); //返回整数,无参数void setOwnerNames(in ListString names); //不返回,包含一个传入List参数BankAccount createAccount(in String name, int startingDeposit, in IAtmService atmService); //返回一个自定义类型int getCustomerList(in String branch, out String[] customerList); //返回整形,输入一个分支,输出一个客户列表}二、实现一个接口//显示的提供一个导出接口,为客户端提供绑定。public class RemoteService extends Service { @Override public IBinder onBind(Intent intent) { if (IRemoteService.class.getName().equals(intent.getAction())) { return mBinder; } if (ISecondary.class.getName().equals(intent.getAction())) { return mSecondaryBinder; } return null; } //第一个接口 private final IRemoteService.Stub mBinder = new IRemoteService.Stub() { public void registerCallback(IRemoteServiceCallback cb) { if (cb != null) mCallbacks.register(cb); } public void unregisterCallback(IRemoteServiceCallback cb) { if (cb != null) mCallbacks.unregister(cb); } };//第二个接口 private final ISecondary.Stub mSecondaryBinder = new ISecondary.Stub() { public int getPid() { return Process.myPid(); } public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) { } };}三、客户端交互/**通过Android.os提供的Parcelable类型来传递数据,通常我们使用Eclipse+ADT插件来完成,在Eclipse中在Package Explorer view视图上单击鼠标右键,选择Create Aidl preprocess file for Parcelable classes(创建aidl预编译文件),最终我们创建一个名为android123.aidl文件*/import android.os.Parcel;import android.os.Parcelable;public final class Rect implements Parcelable {public int left;public int top;public int right;public int bottom;public static final Parcelable.CreatorRect CREATOR = new Parcelable.CreatorRect() {public Rect createFromParcel(Parcel in) {return new Rect(in);}public Rect[] newArray(int size) {return new Rect[size];
您可能关注的文档
- dxp2004使用教程.doc
- 使用Jconsole连接weblogic server.docx
- 应付方式测量结果分析报告.doc
- 国际贸易实务技能测试题.doc
- LEUKEMIAS血癌.docx
- the tiger king and the master cat剧本台词.doc
- 好朋友坏朋友:[6招识破]“自私”的朋友.doc
- 本科第一学期英语作文.doc
- SonicWALL防火墙过滤 VPN 流量.docx
- SJW56 Remote客户端用户安装手册.doc
- 51CTO下载-L2TP.doc
- Oracle 11g R2 RAC with ASM存储迁移_实测.docx
- 解析几何双语卷(07-11级).doc
- ABB电动门检修手册.doc
- 《Steel Roses》.doc
- 探究RIP,EIGP,BGP的第三方下一跳.docx
- 计算机英语-hardware.doc
- 【英语词汇】pain、ache、sore、distress、anguish、misery、agony、torment.doc
- Oracle linux 6 安装oracle 11g R2 官方文档.doc
- Shadow Remover Image Shadow Removal Based on Illumination Recovering Optimization(word版本).doc
文档评论(0)