我有一个包含 9 个按钮的活动,它提供了一些价值。我想按点击顺序获得该值 - 这怎么可能?这是我的代码:
public boolean onTouch(View arg0, MotionEvent arg1) {
// TODO Auto-generated method stub
s1="1";
i1.setImageResource(R.drawable.lockk1);
i1.setBackgroundColor(Color.TRANSPARENT);
// i1.setBackgroundResource(R.drawable.back);
return false;
}
});
});
Button b=(Button)findViewById(R.id.butt);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
System.out.println("**********"+s1+s2+s3+s4+s5+s6+s7+s8+s9+"******");
mydb=LockerActivity.this.openOrCreateDatabase("pattern", MODE_PRIVATE, null);
Cursor cr= mydb.rawQuery("SELECT * FROM patterntable", null);
if (cr.getCount() > 0) {
if(cr.moveToFirst()){
do
{
pass = cr.getString(cr.getColumnIndex("password"));
password=s1+s2+s3+s4+s5+s6+s7+s8+s9;
if(password.equals(pass))
{
Intent i=new Intent(LockerActivity.this,first.class);
startActivity(i);
}
else{
Intent i=new Intent(LockerActivity.this,LockerActivity.class);
startActivity(i);
}
} while (cr.moveToNext());
cr.close();
mydb.close();
}
}
}
});