我有一个拖放游戏。用户必须选择正确的形状进行拖放以组合框。当用户有错误的对象时,如果为true,它将移动到mulai.java然后它将移动到levelbuka.java。我试过这个:
private ImageView myImage,Image2;
private Button submit;
private static final String IMAGEVIEW_TAG = "The Android Logo";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.leveldasar1);
submit=(Button)findViewById(R.id.submit);
// Sets the tag
myImage = (ImageView)findViewById(R.id.image);
myImage.setTag(IMAGEVIEW_TAG);
myImage.setOnLongClickListener(new MyClickListener());
Image2 = (ImageView)findViewById(R.id.image2);
Image2.setTag(IMAGEVIEW_TAG);
Image2.setOnLongClickListener(new MyClickListener());
// set the listener to the dragging data
//myImage.setOnDragListener(new MyDragListener());
findViewById(R.id.bottomlinear).setOnDragListener(new MyDragListener());
findViewById(R.id.toplinear).setOnDragListener(new MyDragListener());
submit.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
if (R.id.bottomlinear == R.drawable.kalkulator){
Intent a = new Intent(getApplicationContext(),levelbuka.class);
startActivity(a);
}else {
Intent a = new Intent(getApplicationContext(),mulai.class);
startActivity(a);
}
但是当我点击提交按钮时,语句将被执行,没有人被移动到mulai.java,尽管图片是正确的合并。我在这里缺少什么?