Android: Problem exiting app
I'm putting a EULA into my app. It pops up when the user first enters, and doesn't go away until the user presses the "I agree" button. All of that works fine. The problem is when the user doesn't push the button. I'd like my app to terminate if the user presses the home button instead of agreeing to the terms, but right now, the home button doesn't work. The app closes briefly, but then opens up again to the EULA page - Basically, once the user opens the app, they cannot use their phone until they agree to the EULA's terms.
Does anybody know what's wrong, or have any ideas about how to fix it?
Thanks
EDIT (here's the code for my EULA class)
public class EU开发者_如何学编程LAActivity extends Activity implements OnClickListener{
@Override public void onCreate(Bundle savedInstanceState)
{
GameEngine.pause();
super.onCreate(savedInstanceState);
//No Title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
//Set the view
setContentView(R.layout.eula_layout);
//Assign onClickListener to button
Button button = (Button)findViewById(R.id.eula_button);
button.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
MainActivity.firstRun = false;
GameEngine.unPause();
this.finish();
}
That is a strange behaviour.
Are you doing anything in the onPause/Stop/Destroy
methods?
How are you presenting the Eula to the user? A dialog?
It seems that something is starting a new instance of your activity...
I worked on this problem for a bit and ended up just implementing my EULA in a completely different way.. Still have no idea what was wrong with it.
I'm not sure if this post will be able to help anyone else-if any moderators come across it, feel free to delete it.
精彩评论