我想从另一个类的doInBackground中的外部方法调用异步电子邮件发送。但总是得到这个异常消息:
01-26 19:01:20.281: E/SMARTT(7131): doInBackground method cannot be processed
01-26 19:01:20.281: E/SMARTT(7131): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
protected String doInBackground(Object... params) {
try {
Log.i(GlobalApplication.APP_LOG_NAMESPACE,"DOING IN BACKGROUND");
String typeOfEmail = (String) params[0];
Map<String, String> data = (Map<String, String>) params[1];
Log.i(GlobalApplication.APP_LOG_NAMESPACE,data.get("ean"));
AppHelper helper = new AppHelper();
helper.sendLogsByEmail(typeOfEmail, data);
return "test";
}
catch (Exception e) {
Log.e(GlobalApplication.APP_LOG_NAMESPACE,"doInBackground method cannot be processed", e);
e.printStackTrace();
return null;
}
}
如何从doInBackGround中的另一个类调用方法(如果可能的话)?