Monday, August 8, 2011

How to display EULA ("End User License Agreement") in Android apps

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 file from

2. Content of file is give below in its entirety. This is just skeleton code intended to illustrate the displaying of EULA in your actual program. 

package com.EULAExample;

import com.EULAExample.Eula.OnEulaAgreedTo;

import android.os.Bundle;
import android.util.Log;

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( == 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>
    <string name="eula_accept">Accept</string>
    <string name="eula_refuse">Refuse</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.

1 comment:

  1. Download file from:
    Link is broken


Please do not hesitate to leave your comments.