I am working on android application in which i am making click listener on image view. I just want to disable image listener, for example i have a edit button , without clicking edit button image view listener should be disabled.
image = (ImageView) findViewById(R.id.image);
editText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (clickCount == 0) {
Toast.makeText(getApplicationContext(), "Enabled",
Toast.LENGTH_SHORT).show();
fName.setEnabled(true);
lName.setEnabled(true);
mailText.setEnabled(true);
mobileText.setEnabled(true);
mCond.setEnabled(true);
mNotes.setEnabled(true);
medication.setEnabled(true);
alReact.setEnabled(true);
dofo.setEnabled(true);
image.setEnabled(true);
editText.setText("Done");
clickCount = 1;
}
else if (clickCount == 1) {
Toast.makeText(getApplicationContext(), "Done",
Toast.LENGTH_SHORT).show();
fName.setEnabled(false);
lName.setEnabled(false);
mailText.setEnabled(false);
mobileText.setEnabled(false);
meond.setEnabled(false);
mNotes.setEnabled(false);
meation.setEnabled(false);
alReact.setEnabled(false);
doInfo.setEnabled(false);
image.setEnabled(false);
editText.setText("Edit");
updatingUser();
clickCount = 0;
}
}
});
just add it in onCreate Method
image.setEnabled(false);
Use this line into your XML:
android:clickable="false"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With