1

我有 2 edittextsans 2 imageviews,我希望按钮点击的意图只有在两个编辑文本都有一些价值并且两个图像视图都被触摸时才有效。
以下代码的问题是,当我运行应用程序时,意图在按钮单击时不起作用...

抱歉,代码格式不佳,但这里是:

iv_other.setOnTouchListener(new View.OnTouchListener() {

    public boolean onTouch(View arg0, MotionEvent event) {
            // TODO Auto-generated method stub
    switch (event.getAction()) {

    case MotionEvent.ACTION_DOWN:
      {
    anim1.start();
    mp.setLooping(true);
    mp.start();
    tv_your.setText("SCANNING....");
    count++;
       }
    break;
    case MotionEvent.ACTION_UP:
       {
    anim1.stop();
    mp.pause();
    iv_other.setImageResource(R.drawable.animation_0);
    tv_your.setText("Thumb Impression Captured");      
        }
    break;
        }
    return true;  
        }
    });
 iv_your.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View arg0, MotionEvent event) {
                // TODO Auto-generated method stub
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
          {
        anim.start();
        mp.setLooping(true);
        mp.start();
        tv_other.setText("SCANNING....");
        count++;
           }
        break;
        case MotionEvent.ACTION_UP:
           {
        anim.stop();
        mp.pause();
        iv_your.setImageResource(R.drawable.animation_0);
        tv_other.setText("Thumb Impression Captured");      
            }
        break;
            }
        return true;  
            }
        });
   converttostring();
    l1=yourname.length(); 
    if(l1!=0)
    {
        count1++;
    }
    l2=othername.length();
    if(l2!=0)
    {
        count1++;
    }
        while(count1>1)
    {
    result.setOnClickListener(new View.OnClickListener() {

        public void onClick(View arg0) {
            // TODO Auto-generated method stub
    if(count>1)
        {
                Intent next = new Intent("com.x9apps.compatibilityscanner.RESULT");
                startActivity(next);
        }   
    }
   });
    }
}
 private void converttostring() {
        // TODO Auto-generated method stub
      yourname =et_your.getText().toString();
      othername = et_other.getText().toString();
        }
    @Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
        super.onBackPressed();
        finish();
    }

这些是我正在使用的变量..请快速帮助 int count=0,l1,l2,count1=0; 静态字符串你的名字,其他名字;

4

0 回答 0