Difference between revisions of "Teams Winter 2011/team1/Android/Send Email"

From CDOT Wiki
Jump to: navigation, search
(Created page with '== 9. Add Send Email functionality == === 9.1 Create the Email menu item === 9.1.1 Add the String value for the layout title to String.xml: <source lang="java"> <string name="e…')
 
Line 60: Line 60:
 
</LinearLayout>
 
</LinearLayout>
 
</source>
 
</source>
 +
 +
9.1.4 Now Add the Email menu Item. Navigate to menu.xml and add the menu item.
 +
<source lang="java">
 +
<?xml version="1.0" encoding="utf-8"?>
 +
<menu
 +
  xmlns:android="http://schemas.android.com/apk/res/android">
 +
    <item android:id="@+id/item1" android:title="Add Student"></item>
 +
    <item android:id="@+id/item2" android:title="Delete Student"></item>
 +
    <item android:id="@+id/item3" android:title="View Student"></item>
 +
    <item android:id="@+id/item4" android:title="Edit Student"></item>
 +
    <item android:id="@+id/item5" android:title="Send E-mail"></item>
 +
</menu>
 +
</source>
 +
 +
9.1.5 Now it is time to build your project so that our id's will be generated.
 +
 +
=== 9.2 ===

Revision as of 16:16, 7 April 2011

9. Add Send Email functionality

9.1 Create the Email menu item

9.1.1 Add the String value for the layout title to String.xml:

<string name="emailContact_textView">Email Contact</string>

9.1.2 Now lets finish our layout email.xml.
EditContactLayout.png

9.1.3 Here is the email.xml implementation:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
   
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:textSize="30dp"
        android:layout_gravity="center"
        android:text="@string/emailContact_textView" />

    <TextView android:id="@+id/emailTo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/emailTo_textView" />

    <EditText android:id="@+id/editEmailTo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView android:id="@+id/emailSubject"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/emailSubject_textView" />

    <EditText android:id="@+id/editEmailSubject"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
       
    <TextView android:id="@+id/emailBody"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/emailBody_textView" />
       
    <EditText android:id="@+id/editEmailBody"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <Button android:id="@+id/emailSend"
        android:layout_column="0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/btnEmailSend" />
</LinearLayout>

9.1.4 Now Add the Email menu Item. Navigate to menu.xml and add the menu item.

<?xml version="1.0" encoding="utf-8"?>
<menu
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/item1" android:title="Add Student"></item>
    <item android:id="@+id/item2" android:title="Delete Student"></item>
    <item android:id="@+id/item3" android:title="View Student"></item>
    <item android:id="@+id/item4" android:title="Edit Student"></item>
    <item android:id="@+id/item5" android:title="Send E-mail"></item>
</menu>

9.1.5 Now it is time to build your project so that our id's will be generated.

9.2