TextView


<TextView 
   android:id="@+id/text1"
   android:layout_width="fill_parent" 
   android:layout_height="wrap_content" 
   android:text="@string/hello"
   android:capitalize="sentences"
/>

<Button 
   android:id="@+id/b1"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@+string/hello"
/>

private void setupButton()
{
   Button b = (Button)this.findViewById(R.id.button1);
   b.setOnClickListener(
         new Button.OnClickListener(){
            public void onClick(View v)
            {
               parentButtonClicked(v);
            }
         });
   
}
private void parentButtonClicked(View v)
{
   this.appendText("\nbutton clicked");
   this.dial();
}

<EditText
   android:id="@+id/editText1"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Enter Text(prompt:)"
/>

android regular expression validators

Search for: android regular expression validators

example regex expressions

Another very nice link on expressions

java.util.regex

Existing intents and uris

Telephone uri standards document

An important package to understand phone number formats

AlertDialog Builder class

You will need to know the DialogInterface

read this on showAlert


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView 
        android:id="@+id/username_view"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:text="@string/alert_dialog_username"
        android:gravity="left"
        android:textAppearance="?android:attr/textAppearanceMedium" />
            
    <EditText
        android:id="@+id/username_edit"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:scrollHorizontally="true"
        android:autoText="false"
        android:capitalize="none"
        android:gravity="fill_horizontal"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/password_view"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:text="@string/alert_dialog_password"
        android:gravity="left"
        android:textAppearance="?android:attr/textAppearanceMedium" />
            
    <EditText
        android:id="@+id/password_edit"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:scrollHorizontally="true"
        android:autoText="false"
        android:capitalize="none"
        android:gravity="fill_horizontal"
        android:password="true"
        android:textAppearance="?android:attr/textAppearanceMedium" />
        
</LinearLayout>

public class PromptListener 
implements android.content.DialogInterface.OnClickListener
{
   public String promptValue = null;
   public void onClick(DialogInterface v, int buttonId)
   {
      promptValue="hello";
   }
}

public static String Prompt(String message, Context ctx)
{
   //load some kind of a view
   LayoutInflater li = LayoutInflater.from(ctx);
   View view = li.inflate(R.layout.promptdialog, null);
   
   //get a builder and set the view
   AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
   builder.setTitle("Prompt");
   builder.setView(view);
   
   //add buttons and listener
   PromptListener pl = new PromptListener(view,ctx);
   builder.setPositiveButton("OK", pl);
   builder.setNegativeButton("Cancel", pl);
   
   //get the dialog
   AlertDialog ad = builder.create();
   
   //show
   ad.show();
   
   //How come the following is "null" ???
   //when it shoudl be "hello" on a button click
   return pl.prompt;
}

A discussion on modal dialogs


public class FrameAnimationActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.frame_animations_layout);
    }
}//eof-class

<ImageView
        android:id="@+id/animationImage"
        android:scaleType="fitCenter"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:visibility="gone" />

<activity android:name=".frameanimation.FrameAnimationActivity"
            android:label="Frame Animation Test">
</activity>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.ai.android.HelloWorld"
      android:versionCode="1"
      android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".HelloWorld"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".animation.Transition3d"
                  android:label="@string/app_name">
        </activity>
        <activity android:name=".frameanimation.FrameAnimationActivity"
                  android:label="Frame Animation Test">
        </activity>
    </application>
</manifest>

public static void invokeAnimActivity(Activity inActivity)
	{
		Intent intent = new Intent(inActivity,Transition3d.class);
		inActivity.startActivity(intent);
	}
	public static void invokeAnimActivity1(Activity inActivity)
	{
		Intent intent = new Intent();
		ComponentName cn = new ComponentName("com.ai.android.HelloWorld"
				,"com.ai.android.HelloWorld.animation.Transition3d");
		intent.setComponent(cn);
		inActivity.startActivity(intent);
	}

public static void invokeFrameAnimActivity(Activity inActivity)
{
  Intent intent = new Intent(inActivity,FrameAnimationActivity.class);
  inActivity.startActivity(intent);
}

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- This group uses the default category. -->
    <group android:id="@+id/menuGroup_Main">
    
        <item android:id="@+id/OpenGL10_activity"
            android:orderInCategory="1"
            android:title="10 Simple Triangle" />
            
        <item android:id="@+id/OpenGL15_activity"
            android:orderInCategory="2"
            android:title="15 Simple Triangle" />
            
        <item android:id="@+id/menu_clear"
            android:orderInCategory="10"
            android:title="clear" />
    </group>
</menu>

@Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
    	//call the parent to attach any system level menus
    	super.onCreateOptionsMenu(menu);
    	int base=Menu.FIRST; // value is 1
    	menu.add(base,base,base,"Test OpenGL");
    	return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) 
    {
    	if (item.getItemId() == Menu.FIRST)
    	{
    		Intent intent = new Intent(this,OpenGLTestHarnessActivity.class);
    		startActivity(intent);
        	return true;
    	}
    	return super.onOptionsItemSelected(item);
    }

@Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
    	//call the parent to attach any system level menus
    	super.onCreateOptionsMenu(menu);
   	MenuInflater inflater = getMenuInflater(); //from activity
   	inflater.inflate(R.menu.main_menu, menu);
    	return true;
    }

@Override
    public boolean onOptionsItemSelected(MenuItem item) 
    {
    	if (item.getItemId() == R.id.OpenGL10_activity)
    	{
  		this.invoke10SimpleTriangle();
        	return true;
    	}
    	if (item.getItemId() == R.id.OpenGL15_activity)
    	{
    		this.invoke15SimpleTriangle();
        	return true;
    	}
    	return super.onOptionsItemSelected(item);
    }

window/
show view/
other/
android/
logcat