如何从一个活动到另一个活动的状态调用一个动作?

时间:2018-10-14 05:41:52

标签: android class action

我想从Admin类的ActivityEmail调用按钮单击操作。 目的:我想在条件满足时发送电子邮件。

ActivityEmail中的按钮操作代码:

new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            sendEmailButton.performClick();
        }
    }, 10);


    sendEmailButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            myEmailString = emailFrom.getText().toString();
            passString = emailFromPassword.getText().toString();
            sendToEmailString = emailTo.getText().toString();
            subjectString = emailSubject.getText().toString();
            textString = emailBody.getText().toString();

            sendEmailTask.execute();
        }
    });

在Admin类的这种情况下:

@Override
public void onPasswordFailed(Context ctxt, Intent intent) {

    //here I want to call that button click action from another class//

    Toast.makeText(ctxt, R.string.password_failed, Toast.LENGTH_LONG)
            .show();
    Log.d(TAG, "onPasswordFailed: FAILED");
}

我该怎么做?

TIA

0 个答案:

没有答案