2014年2月11日

Local Bound Service Remote Bound Service

摘要: 首先创建子类 BoundService 继承 Service; 在BoundService 中创建子类 MyBinder 继承 Binder; Binder的作用就是进程内或进程之间 service 和client 交互的媒介(我现在暂时这么认为), MyBinder 中 实现 getService()的方法, 返回当前BoundService; 在要使用Service的Activity中 使用bindService (); 此时,你需要创建一个 ServiceConnection 去连接Activity 和 Service 。 改写ServiceConnection的2个方法public . 阅读全文

posted @ 2014-02-11 14:49 小白说我是2B 阅读(203) 评论(0) 推荐(0) 编辑

Activity之间切换 以及传值

摘要: Activity A 生成 Activity B 若A想得到B的数据,则B需要作为A的subActivity 则需要在 Activity A中调用startActivityForResult(Intent,int); //Intent int为标识码 requestCode 然后 在Activity A 中重写 onActivityResult(int requestCode,int resultCode,Intent data) 判断requestCode 与之前startActivityForResult()传入的标识码是否相同,再判断res... 阅读全文

posted @ 2014-02-11 10:49 小白说我是2B 阅读(206) 评论(0) 推荐(0) 编辑

自定义Fragment

摘要: 自定义Fragment 需要重写public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle savedInstanceState) ; http://www.techotopia.com //这个网站非常好,英语教学,有图有步骤,适合初学,有很多方面的知识。 阅读全文

posted @ 2014-02-11 09:37 小白说我是2B 阅读(153) 评论(0) 推荐(0) 编辑

导航