Difference between revisions of "Teams Winter 2011/team1/Android/Edit Contact"
Ladanzahir (talk | contribs) (→8. Edit Contact) |
Ladanzahir (talk | contribs) (→8. Edit Contact) |
||
Line 1: | Line 1: | ||
=== 8. Edit Contact === | === 8. Edit Contact === | ||
====8.1 Create Edit Layout | ====8.1 Create Edit Layout | ||
− | 8.1.1 Add the String value for the layout title to String.xml: | + | 8.1.1 Add the String value for the layout title to String.xml:==== |
<source lang="java"> | <source lang="java"> | ||
<string name="editContact_textView">Edit Contact</string> | <string name="editContact_textView">Edit Contact</string> | ||
Line 37: | Line 37: | ||
</source> | </source> | ||
− | ====8.2 Create EditContactActivity | + | ====8.2 Create EditContactActivity==== |
Create the EditContactActivity in your package and make sure it extends Activity class. | Create the EditContactActivity in your package and make sure it extends Activity class. | ||
<source lang="java"> | <source lang="java"> | ||
Line 50: | Line 50: | ||
} | } | ||
</source> | </source> | ||
− | ====8.3 Add the EditContactActivity to the Android Manifest | + | ====8.3 Add the EditContactActivity to the Android Manifest==== |
− | ====8.4 Implement The EditContact in the main activity class | + | ====8.4 Implement The EditContact in the main activity class==== |
− | ====8.5 Edit Contact In action | + | ====8.5 Edit Contact In action ==== |
[[Image: editMenuOption.png | 450px]]<br/> | [[Image: editMenuOption.png | 450px]]<br/> | ||
[[Image: editView.png | 450px]]<br/> | [[Image: editView.png | 450px]]<br/> | ||
[[Image: editViewEdited.png | 450px]]<br/> | [[Image: editViewEdited.png | 450px]]<br/> | ||
[[Image: editViewSaved.png | 450px]]<br/> | [[Image: editViewSaved.png | 450px]]<br/> |
Revision as of 11:17, 7 April 2011
Contents
8. Edit Contact
====8.1 Create Edit Layout 8.1.1 Add the String value for the layout title to String.xml:====
<string name="editContact_textView">Edit Contact</string>
8.1.2 Right click on layout -> New -> Android XML File .
8.1.3 Enter edit.xml for the file name and check Layout:
8.1.4 Using Linear Layout, create this layout for editing contact information:
8.1.5 Here is the edit.xml implementation:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/titleTextViewEdit"
android:gravity="center_vertical" android:textSize="30dp"
android:layout_gravity="center" android:text="@string/editContact_textView"></TextView>
<EditText android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginBottom="3dp" android:hint="@string/hint_first_name" android:id="@+id/firstNameEdit"></EditText>
<EditText android:layout_width="match_parent"
android:layout_height="wrap_content" android:isScrollContainer="true"
android:layout_marginBottom="3dp" android:hint="@string/hint_last_name" android:id="@+id/lastNameEdit"></EditText>
<EditText android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginBottom="3dp" android:hint="@string/hint_email" android:id="@+id/emailEdit"></EditText>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/saveContact_buttonEdit"
android:text="@string/saveButton" android:gravity="center_horizontal"
android:layout_gravity="center_horizontal" android:textSize="20dp"></Button>
</LinearLayout>
8.2 Create EditContactActivity
Create the EditContactActivity in your package and make sure it extends Activity class.
package cs.ecl.team1.android;
import android.app.Activity;
public class AddContactActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}