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.

Wednesday, June 29, 2011

How to programmatically add cells (Views) and rows in TableLayout

 Following are the steps for programmatically adding rows in a TableLayout:

1. Manually include a TableLayout in your main.xml file with an id, say, "TableLayout01". Obtain a reference to the TableLayout as:
       
    table = (TableLayout) findViewById(R.id.TableLayout01); 

Note: Ensure to define the variable "table" outside onCreate() inside the class as: TableLayout table;

How to display grids on TableLayouts

Android TableLayouts apparently do not have an option to show grids on the tables. In the following example, grid-like appearance is creates by setting margins around each TextView inside the table, and setting different background colors for the TableLayout and the TextViews.

Friday, June 17, 2011

How to use a AutoCompleteTextView

AutoCompleteTextView an editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with (from Android documentation).

How to set horizontal and vertical scroll bars

Here is how to make the horizontal and vertical scroll bars appear on the screen WHEN the the application becomes wider  than the phone screen. Scroll bars will appear only when the user needs them; will hide when not needed.