I am developing a sample app where I have an AsyncTask within a main Activity, I am also having broadcast receiver that listens for incoming sms.....
What i need to do is pass the message body from broadcast receiver to asynctask which is already listening for an incoming data using socket connection. i don't know how to call the method defined in Asynctask from broadcast receiver.
Plz guide.
read about AsyncTask this will be helpful
private class MyTask extends AsyncTask<String, Integer, String> {
protected String doInBackground(String... str) {
//return str[0];
return null;
}
protected void onProgressUpdate(Integer... progress) {
}
protected void onPostExecute(String result) {
}
}
new MyTask().execute("MSG body");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.