【发布时间】:2012-06-27 15:21:09
【问题描述】:
我写了一些代码,活动启动一个服务以从 URL 获取一些文本,在服务完成后我想将此参数返回给活动。
我的代码如下所示:
public class splash extends AsyncTask<String, Void, String> {
private Context context;
private ProgressDialog Dialog;
protected config app;
public splash(Context context){
this.context=context;
Dialog = new ProgressDialog(context);
}
protected String doInBackground(String... params) {
//starts service number activite
Intent serviceIntent = new Intent();
serviceIntent.setAction("services.conServise");
context.startService(serviceIntent);
我不想使用全局参数而不是单例
【问题讨论】:
标签: android design-patterns service