AndroidIPC机制ACtivity绑定Service实现通信-创新互联

本篇文章为大家展示了Android IPC机制ACtivity绑定Service实现通信,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

创新互联建站主要为客户提供服务项目涵盖了网页视觉设计、VI标志设计、成都全网营销推广、网站程序开发、HTML5响应式网站建设成都做手机网站、微商城、网站托管及成都网站维护公司、WEB系统开发、域名注册、国内外服务器租用、视频、平面设计、SEO优化排名。设计、前端、后端三个建站步骤的完善服务体系。一人跟踪测试的建站服务标准。已经为混凝土泵车行业客户提供了网站改版服务。

Binder通信过程类似于TCP/IP服务连接过程binder四大架构Server(服务器),Client(客户端),ServiceManager(DNS)以及Binder驱动(路由器)

其中Server,Client,ServiceManager运行于用户空间,驱动运行于内核空间。这四个角色的关系和互联网类似:Server是服务器,Client是客户终端,SMgr是域名服务器(DNS),驱动是路由器。

book.java

package com.example.android_binder_testservice;

import android.os.Parcel;
import android.os.Parcelable;

public class Book implements Parcelable {
  private String bookName;
  private String author;
  private int publishDate;

  public Book() {

  }

  public Book(String bookName, String author, int publishDate) {
    super();
    this.bookName = bookName;
    this.author = author;
    this.publishDate = publishDate;
  }

  public String getBookName() {
    return bookName;
  }

  public void setBookName(String bookName) {
    this.bookName = bookName;
  }

  public String getAuthor() {
    return author;
  }

  public void setAuthor(String author) {
    this.author = author;
  }

  public int getPublishDate() {
    return publishDate;
  }

  public void setPublishDate(int publishDate) {
    this.publishDate = publishDate;
  }

  @Override
  public int describeContents() {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel out, int flags) {
    out.writeString(bookName);
    out.writeString(author);
    out.writeInt(publishDate);
    
  }
  
  
  

  public static final Parcelable.Creator CREATOR = new Creator() {
    @Override
    public Book[] newArray(int size) {
      return new Book[size];
    }


    @Override
    public Book createFromParcel(android.os.Parcel source) {
      return new Book(source);
    }
  };

  public Book(Parcel in) {
    bookName = in.readString();
    author = in.readString();
    publishDate = in.readInt();
  }
}

分享题目:AndroidIPC机制ACtivity绑定Service实现通信-创新互联
文章转载:http://pwwzsj.com/article/dggsio.html