Search code examples
androidandroid-activityandroid-manifestintentfiltereula

Do I really need another <activity> in the manifest file for the EULA?


I have a simple single-activity app. I now want to add another page for the EULA, displayed when the user presses a button.

Do I need to define another activity for that?

Would defining another <intent-filter> within the existing <activity> suffice?


Solution

  • No you do not need a new activity in the manifest. I suggest the following: Download and add this class to your project: http://code.google.com/p/apps-for-android/source/browse/trunk/DivideAndConquer/src/com/google/android/divideandconquer/Eula.java?r=93

    After that put a text file, containing the EULA text into the "asset" application folder. A sample Eula you can find here: http://www.developer-resource.com/sample-eula.htm

    Finally call Eula.show(this) in the Create event handler of your main Activity or in your example in the listener of the button.

    Keep in mind, that this class tracks what the user has chosen (accept/decline). But you can overwrite this: The following code should be inserted at the begining of show() method in the provided Eula class: preferences.edit().putBoolean(PREFERENCE_EULA_ACCEPTED, false).commit(); Now the Eula will show up with every button click...