How can I pass a Context object to a thread on call

Posted by Pentium10 on Stack Overflow See other posts from Stack Overflow or by Pentium10
Published on 2010-05-12T09:20:01Z Indexed on 2010/05/12 9:24 UTC
Read the original article Hit count: 208

Filed under:
|

I have this code fragment:

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);
}

I execute this thread as

new ExportDatabaseFileTask().execute();

As you see I use a ctx as Context variable in the new ProgressDialog call, how do I pass a context to the call method?

to this one:

new ExportDatabaseFileTask().execute();*

© Stack Overflow or respective owner

Related posts about java

Related posts about android