I am creating an app in which on clicking on button user can send email.
But I want the task of sending email should be done in Background.
Someone suggested me to use AsyncTask but I am totally unaware of this.
can anybody tell me how to do it ?
I have sendEmail function which takes two string parameters(username , password) and I don’t know how to pass that two string args to AsyncTask and to doInBackground method.
my sendEmail function is
public void sendEmail(String ownerEmailid, String datapwd )
{
try {
GMailSender sender = new GMailSender( ownerEmailid, datapwd );
sender.sendMail( "This is Subject",
"Hey buddy listen to this station it is awesome",
ownerEmailid,
email );
} catch( Exception e ) {
Log.e("SendMail", e.getMessage(), e);
}
}
please suggest solution.
in onClick call