NiethanX NiethanX - 6 months ago 36
Android Question

Android - Enabling and Disabling Send Email Button

In my application, there is a button that connects the app to mail applications for sending an email. I'm trying to disable the button after clicking one time but I couldn't understand where should I enable the button again which causes no problem. Here is my code:

tvAboutEmail.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto","", null));
startActivity(Intent.createChooser(emailIntent, "Sending With:"));

Answer Source

You can enable the button on method onResume on your activity. Or you can create a thread that enable the button after n seconds. But this business logic decision that you have to make.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download