This example shows a barebone program to illustrate how to incorporate displaying EULA to user in an Android App. User can only proceed with using the app if he or she accepts the EULA. Once accepted, EULA will not be shown next time.
This Eclipse screen shot below shows the structure of the directories and the required files. Please review this.
1. Download Eula.java file from http://code.google.com/p/apps-for-android/source/browse/trunk/DivideAndConquer/src/com/google/android/divideandconquer/Eula.java?r=93
2. Content of EULAExampleActivity.java file is give below in its entirety. This is just skeleton code intended to illustrate the displaying of EULA in your actual program.
public class EULAExampleActivity extends Activity implements OnEulaAgreedTo
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState)
//display EULA - intended for one time display if user accepts it.
if( Eula.show(this) == true ) //...Proceed UI creating and further only if user accepts EULA
//..Move setContentView to onEulaAgreedTo() function, see below
//..Nothing else goes here -- move all UIs, etc to onEulaAgreedTo() method
} //End of onCreate
public void onEulaAgreedTo()
// TODO Auto-generated method stub
//Log.d("EULAExample", "1. inside onEulaAgreedTo");
//..move all you UIs, etc. hire -- do not keep anything in onCreate()
//Log.d("EULAExample", "2. inside onEulaAgreedTo");
} //end of onEulaAgreedTo method
} //End of outer class
3. Add these to the res\values\strings.xml file:
<string name="eula_title">End-User License Agreement</string>
4. Google the web for a sample EULA file. Modify as needed. Prepare a EULA file (a text file, Notepad can be used to create and save it). Drag and drop it under assets folder while in Eclipse. Important: EULA file cannot have any extension -- file name is simply, say, EULA
That must be it. Let me know if any problem.