The completion of the third iteration target is as follows:
First, account information . the interface is designed as follows:
The main XML code is :
<tablelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
xmlns:tools= "Http://schemas.android.com/tools"
android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
tools:context= "Com.edg.foodie.activity.SettingPasswdActivity" >
<TableRow>
<textview
android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:text= "Initial password:"
android:textsize= "20SP"
/>
<edittext
android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:hint= "Please enter the initial password"
android:selectallonfocus= "true"
/>
</TableRow>
<TableRow>
<textview
android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:text= "Change Password:"
android:textsize= "20SP"
/>
<edittext
android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:hint= "Please enter the password to be modified"
android:selectallonfocus= "true"
/>
</TableRow>
</TableLayout>
The main Java code is as follows:Package com.edg.foodie.activity;
import Android.app.AlertDialog;
import Android.content.DialogInterface;
import android.content.Intent;
import Android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import Android.os.Bundle;
import Android.view.View;
import android.widget.TableLayout;
import Android.widget.TextView;
import Android.widget.Toast;
import COM.EDG.FOODIE.R;
Public class Accountactivity extends Appcompatactivity {
private TextView TextView;
@Override
protected void OnCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
Setcontentview (r.layout.activity_account);
TextView = (textView) Findviewbyid (R.id.dlbutton);
Textview.setonclicklistener (New View.onclicklistener () {
@Override
Public void OnClick (View v) {
tablelayout setpasswd = (tablelayout) getlayoutinflater (). Inflate (R.LAYOUT.ACTIVITY_SETTING_PASSWD, nul l);
new Alertdialog.builder (accountactivity.this). Settitle ("Change Password"). Setview (SETPASSWD). Setpositivebutton (" New Dialoginterface.onclicklistener () {
@Override
Public void OnClick (dialoginterface dialog, int which) {
Toast.maketext (Accountactivity.this, "modified successfully", Toast.length_short). Show ();
}
}). Setnegativebutton ("Cancel", new Dialoginterface.onclicklistener () {
@Override
Public void OnClick (dialoginterface dialog, int which) {
finish ();
}
}). Create (). Show ();
}
//Intent Intent = new Intent (accountactivity.this, settingpasswdactivity.class);
//Startactivityforresult (intent, 1);
});
}
@Override
protected void Onactivityresult (int requestcode, int resultcode, Intent data) {
//Determine if the request code is the request code used to start activity B
if (Requestcode = = 1) {
//Determine if the return code is successful
if (ResultCode = = RESULT_OK) {
if (ResultCode = = RESULT_OK) {
Textview.settext ("set");
Textview.settextcolor (color.red);
}
}
}
}
This is the last iteration of this project, and for this iteration, the interface design was done smoothly, but the Java part took a long time to complete, Read the last semester of the textbook, check the information, also searched the internet a lot of similar code, finally finished my fourth this iteration goal, but also very thanks to my little friends for their help.
Fourth iteration goal completion and impressions