android - How to show up the second screen again -


I have an application with a very simple UI. Most of the work (bulk processing of images) is done in the background using AsyncTask.

There are only two artifacts in it, the first activity (main screen) lets the user choose some options and then closes the job. The second screen (the progress screen) is a progress bar and the current position of the job with the message Reflects.

This works fine.

The problem here is that background work may take hours. If the user selects the "Back" button, on the progress screen, background work is still going on.

Later if he wants to go back & amp; See progress, there is no way to do this. I restart the app, it goes to the main screen, does not go to the progress screen. I know that background work is going on, because from now on I am about to process each image in the logad I'm entering a message, but I do not see any way to go back to the progress screen.

I have seen around, I think I have to put something in on-thott (). RASTERT () on the progress screen, but it's not sure whether ...

I should mention that this app is not for the general public, but only for internal use (we have an Android Is to compare image processing done by other systems).

You can try to enter that processing logic inside the service (Users who are running long-term operations without intervention), then how can your other activity know how the work is progressing? This can be done in different ways ...

  • You can send broadcast messages from service threads (which are processing images), and catch them in your activity. .
  • You can continue making progress wherever you can and then read your activity periodically.
  • If you want to keep the progress in more real-time , then you indicate the result receiver for the service and the progress of the activity from there. is.
  • etc.

Comments