zoukankan      html  css  js  c++  java
  • 安卓学习47

    今天学习了安卓的一些知识其中主要的是:

    Service 服务 后台运行没有界面 执行耗时的操作 单例 但是要开线程
    1 init 初始化 1.1 MyService extends Service 1.2 注册 
    2 启动方式:2.1 startServie() stopService() onCreate() onStart() onDestory()
    2.2 bindService() unbindService() onCreate() onBind() onUnbind() onDestory()
    3 bindService ServiceConnection onBind() -->IBinder 调用服务里面的方法
    3.1 本地 1 定义一个接口 2 MyService private class MyBinder extends Binder implements 接口 
    3.2 其他应用程序的
    aidl 解决跨进程访问的问题 需要带包复制
    1 定义一个接口 
    2 把.java修改为.aidl 去掉public 
    3 MyService private class MyBinder extends Stub
    4 Activity Stub.asInterface(IBinder);

    aidl里面可能要传递对象
    1 MyBean implments Parcalable 
    2 编写aidl描述文件
    package com.itcast.service.domain;
    parcelable Student;

    ContentProvdier
    BroadcastReceiver

  • 相关阅读:
    UVa 1331 最大面积最小的三角剖分
    UVa 1626 括号序列(矩阵连乘)
    POJ 3295 Tautology(构造法)
    POJ 2586 Y2K Accounting Bug(贪心)
    POJ 2109 Power of Cryptography
    abcd
    好数
    Gift
    密码游戏
    约瑟夫游戏
  • 原文地址:https://www.cnblogs.com/092e/p/14916684.html
Copyright © 2011-2022 走看看