我有這樣的代碼片段:我如何傳遞一個上下文對象的線程中調用
public static class ExportDatabaseFileTask extends AsyncTask<String, Void, Boolean>
{
private final ProgressDialog dialog = new ProgressDialog(ctx);
protected void onPreExecute();
protected Boolean doInBackground(final String... args);
protected void onPostExecute(final Boolean success);
}
正如你看到我用CTX作爲上下文變量我執行這個線程作爲
new ExportDatabaseFileTask().execute();
在新的ProgressDialog調用中,如何將上下文傳遞給調用方法?
這一個:
new ExportDatabaseFileTask().execute();*
爲什麼你會在AsyncTask裏面有ProgressDialog? 我總是把它放在我的活動中,並使用publishProgress – Macarse 2010-05-12 11:43:10