How to disable button click?

后端 未结 5 1177
滥情空心
滥情空心 2020-12-28 08:35

In my android application, there are number of images in drawable folder. In my layout there are two buttons: Back and Next buttons. On clicking next and back buttons 2 diff

5条回答
  •  一生所求
    2020-12-28 08:56

    case R.id.next:
            Log.i("Tag","tag");
            if(imageCounter < imageList.length)
            {
                imageCounter++;
                imagePath = imageList[imageCounter];
                if (imageCounter==(imageList.length)-1)
                {
                    ImageButton next=(ImageButton)findViewBYId(R.id.next);
                    next.setEnabled(false);
                }
            }
            break;
        case R.id.back:
            if(imageCounter > 0)
            {
                imageCounter--;
                imagePath = imageList[imageCounter];
                if (imageCounter==0)
                {
                    ImageButton back=(ImageButton)findViewBYId(r.id.back);
                    back.setEnabled(false);
                }
            }
            break;
    

提交回复
热议问题