Just wondering if I could gather some constructive comments. Well, I am developing a tabbed application with activity group for each tab and related child activities. One of the activities handles a file downloader- waits for the download link from the server, once received download begins in the background. On completion, the file (mostly PDF) opens up in a generic viewer. This part works exceptionally well.
Now, coming to app requirement, I want the activity to run in background. When the user is in the download page, it shows a progress dialog with necessary messages. User, having decided to switch to other screens, moves to other screens. In real, the downloader activity should run in background.
A typical download activity class looks like:
public class DownloadActivity extends Activity {
public void onCreate(Bundle state) { //code here}
public void onPause() {//can anything be done here?}
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
//go back to previous screens to check other features
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
//onBackPressed()- current activity is killed and new one is created
parentActivity.onBackPressed();
return true;
}
return super.onKeyUp(keyCode, event);
}
}
I want to modify the above activity to help it work background while user plays arounds with other screen.
Any thoughts?
Hope it is not very confusing! Let me know in case you don't understand any of the above.
Thanks in advance!