Hi everyone,

I'm working on developing my first real application beyond the basic
tutorials. It is a fairly simple flashcard program for me to use in
school and I have it up and running smoothly. It utilizes a set of
variables to keep track of how many and which cards I have seen,
nothing too fancy. However, sometimes when I switch to another
application and come back to my program, it restarts everything, while
in other instances it will pick up where the program left off. There
doesn't seem to be any pattern to when the program resets, and I don't
have any task killer software installed that would end the program
without my knowledge.

I am inquiring how I tell the program to simply continue running in
the background, and then if there is a function I can insert to "quit"
the program so I can assign that to a button? I posted the start up
code below, and would be happy to post more if someone could direct me
to what would be relevant. As you can see I have it programed to go to
the app's home screen when the app loads for the first time, which
works if the app has quit and is restarting, but in most circumstances
it resumes the flashcard portion, almost as if you had loaded the
program and pressed the resume button from the home screen (which is
what I want to happen all the time). I would be fine with loading the
home screen every time someone switched out of the application, as
long as the variables didn't reset when that happens. Any advice would
be much appreciated.

@Override
public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home);
        goHome();
}

public void goHome(){ //defines the home screen
        setContentView(R.layout.home);


    final Button instructionButton = (Button)
findViewById(R.id.instructionButton);
    instructionButton.setOnClickListener(this);

    final Button newButton = (Button) findViewById(R.id.newButton);
    newButton.setOnClickListener(this);

    final Button resumeButton = (Button)
findViewById(R.id.resumeButton);
    resumeButton.setOnClickListener(this);

    final Button reviewButton = (Button)
findViewById(R.id.reviewButton);
    reviewButton.setOnClickListener(this);
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to