Take the 2-minute tour ×

I'm develop a download manager function which the dialog will popup when the the item was finished download. the download function was running at background.

my question is how can I know when the downloading was finished and the project is intent other activity?

for example:

if(download_state == TASK_FINISH){
    //download Finish

the above method where should I put? i try put it at onResume(), onStart() in every activity which will open by user. but unlucky it won't work.You reply is appreciated.

p/s: I'm sorry about my bad english, hope you guys understand what I'm talking about.

Thank you.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

this is the method I'm using. There can be better ways but this works for me.

public static final int MSG_DOWNLOADED = 0;
//to demonstrate the background process
ProgressDialog pd;

pd = ProgressDialog.show(this, "title", "text", true, false);
new Thread() {
    public void run() {
        // Download image then continue
        // For Example: downloadImg("file");

private Handler handler = new Handler() {

    public void handleMessage(Message msg) {
        switch (msg.what) {
            case MSG_DOWNLOADED:
                // What to do when ready, example:
                    new Intent( [yourclass].this, [yourintent].class ) );

Hope this helps :)

share|improve this answer
it work!! thanks onik. Thank you very much~ –  WynixToo Aug 12 '10 at 4:44

Your Answer


