求教 大神 Android 图形解锁和Activity销毁的问题?
--------------------编程问答-------------------- NinePointLineView这个类定义一个内部接口类 OnLockReleasedListener和一个该接口类的成员变量,还有一个方法setOnLockReleasedListener(OnLockReleasedListener listener),你的ImageLockActivity类来实现这个接口,并设置setOnLockReleasedListener(this);
public class NinePointLineView extends View {
。。。。。。
OnLockReleasedListener mListener;
。。。。。。
public void setOnLockReleasedListener(OnLockReleasedListener listener) {
mListener = listener;
}
public inte易做图ce OnLockReleasedListener {
void onLockReleased(boolean released);
}
}
public class ImageLockActivity extends Activity implements
NinePointLineView.OnLockReleasedListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
NinePointLineView v = new NinePointLineView(this);
v.setOnLockReleasedListener(this);
setContentView(v);
}
@Override
public void onLockReleased(boolean released) {
//To change body of implemented methods use File | Settings | File Templates.
if (released) {
finish();
}
}
}
--------------------编程问答--------------------
忘了一点就是在finishDraw函数中调用
private void finishDraw() {--------------------编程问答-------------------- 帖子别沉了啊
........
boolean isLockReleased = /////楼主该你出手了,判断是否解锁成功
mListener.onLockReleased(isLockReleased);
}
补充:移动开发 , Android