• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps AppStart -> multiple Dialogs, one after another?

Hello everyone,

I'm new to android development (java-dev, too) and got stuck with my first problem:

What my app does is the following:
- it reads a local xml file (it exists)
- from that xml file it builds a list
- with every xml-item there's a local file attached (if exists)
- on list-click the files are opened

The problem is what i'd like to happen on program start:
- start the program
- check for existing xml file if not download (works)
- xml-file to old -> showDialog(0);
-> inside dialog choose (update now or later)
- AFTER THAT
- render the list
- AFTER THAT
- check for each list item if a local file exists
- at the end of that showDialog(1) (download missing files yes/no)?


THe way i've done it - which is obviously wrong - is like that:
Code:
public void onCreate(Bundle savedInstanceState){
  /**
   * Check for updated xml file
   */
  if (srvUpdate.checkForUpdatesOfXmlFile()) {
    showDialog(DIALOG_DOWNLOAD_XML_FILE);
  }
	
  /**
   * create the list
   */
  createXmlListView();

  /**
   * check for missing files
   */
  Integer _iNumberOfUpdates = srvUpdate.checkForUpdatesOfDocumentFiles();
  if (_iNumberOfUpdates > 0) {
    showDialog(DIALOG_DOWNLOAD_DOCUMENTS);
  }
}

Because what happens is the following:
- the program starts
- dialog_download_documents is shown
- the list is shown
- dialog_download_xml_file is shown

All at the same time, goign by the way "I THINK" this is not wanted though.

So far i understand that there is no "wait for user input" in android. What i don't understand however is: "How do other Programs handle such a task when starting the app"?

Any links with the information i need - or even the topics i should look myself into - are greatly appreciated!

thanks in advance

/sam
 
Okay, i've read a little more and thought about possibilities and the thing i come up with is using my UpdateService class which extends IntentService and from that send Broadcasts to the mainclass which then handles what's done next so that basically i have broadcasts running around from which certain actions are started.

Is this the "correct" way of doing things or are there way more elegant ways? (which the later i assume is the case ^^)

Coding like this just doesn't seem "clean" ;)
 
Back
Top Bottom