建立两个Activity,当点击屏幕的时候,调到另外一个Activity,设置屏幕颜色,彼此来回切换。
新建BinderData.java类
package com.android.testrecord;
import android.os.Binder;
/**
* Created by wang on 16-11-1.
*/
public class BinderData extends Binder {
private int color;
public int getColor() {
return color;
}
public void setColor(int color) {
this.color = color;
}
}
新建MyColor.java 类
package com.android.testrecord;
import android.graphics.Color;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by wang on 16-11-1.
*/
public class MyColor implements Parcelable{
private BinderData data = new BinderData();
public MyColor() {
data.setColor(Color.BLACK);
}
protected MyColor(Parcel in) {
data = (BinderData) in.readValue(BinderData.class.getClassLoader());