H On Sat, Aug 27, 2011 at 2:27 PM, aparna rani <indela....@gmail.com> wrote:
> hi i am implementing change password option in my app. i displayed dialog > alert box. > when i trying to get data from edittext failed. why i don't know please > help me? > > LayoutInflater factory = LayoutInflater.from(this); > final View textEntryView = factory.inflate(R.layout.password, > null); > > AlertDialog.Builder alert = new AlertDialog.Builder(this); > > alert.setTitle("Change Passwoed"); > alert.setView(textEntryView); > AlertDialog changePassword = alert.create(); > > final EditText oldPassword = (EditText) > changePassword.findViewById(R.id.old_password); > final EditText newPassword = (EditText) > changePassword.findViewById(R.id.new_password); > final EditText retypePassword = (EditText) > changePassword.findViewById(R.id.retype_password); > alert.setPositiveButton("Submit", new > DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, int whichButton) > { > String oldPass=oldPassword.getText().toString(); > String newPass=newPassword.getText().toString(); > String retypePass=retypePassword.getText().toString(); > > if(oldPass.trim().length()==0||newPass.trim().length()==0||retypePass.trim().length()==0) > { > displayAlert("Enter three fields"); > } > > } > }); > > alert.setNegativeButton("Cancel", new > DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, int whichButton) { > // Canceled. > } > }); > alert.show(); > > //password.xml > > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" > android:orientation="vertical" > android:layout_width="fill_parent" > android:layout_height="fill_parent"> > <TableLayout android:id="@+id/LinearLayout_item" > android:layout_width="fill_parent" > android:layout_height="fill_parent"> > <TableRow> > <EditText android:id="@+id/old_password" > android:layout_width="fill_parent" > android:password="true" > android:singleLine="true" > android:hint="Old Password"/> > </TableRow> > <TableRow> > <EditText android:id="@+id/new_password" > android:hint="New Password" > android:layout_width="fill_parent" > android:password="true" > android:singleLine="true"/> > </TableRow> > <TableRow> > <EditText android:id="@+id/retype_password" > android:layout_width="fill_parent" > android:hint="Retype New Password" > android:password="true" > android:singleLine="true"/> > </TableRow> > </TableLayout> > </LinearLayout> > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en