Advertisement
Guest User

Untitled

a guest
May 2nd, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. AlertDialog.Builder loginBuilder = new AlertDialog.Builder(this);
  2. loginBuilder.setCancelable(false)
  3. .setTitle("Login Panel");
  4.  
  5. LayoutInflater inflater=getLayoutInflater();
  6.  
  7. //adding the inflater object to the view
  8.  
  9. View view=inflater.inflate(R.layout.login_form, null);
  10.  
  11. final EditText emailId=(EditText)view.findViewById(R.id.editText_mailId);
  12. final EditText passCode=(EditText)view.findViewById(R.id.editText2_passcode);
  13.  
  14. loginBuilder.setView(view);
  15.  
  16. loginBuilder.setPositiveButton("Login", new DialogInterface.OnClickListener() {
  17.  
  18. public void onClick(DialogInterface dialog, int which) {
  19. // TODO Auto-generated method stub
  20. //do something
  21. }
  22. });
  23.  
  24. loginBuilder.setNegativeButton("Register", new DialogInterface.OnClickListener() {
  25.  
  26. public void onClick(DialogInterface dialog, int which) {
  27. // TODO Auto-generated method stub
  28. makeAToast("You have to Register first");
  29. finish();
  30. }
  31. })
  32. .show();
  33.  
  34.  
  35. R.layout.login_form::
  36.  
  37. <?xml version="1.0" encoding="UTF-8"?>
  38. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  39. android:id="@+id/relativeLayout1"
  40. android:layout_width="fill_parent"
  41. android:layout_height="fill_parent"
  42. android:background="@drawable/login_alert_shape">
  43.  
  44. <EditText
  45. android:id="@+id/editText_mailId"
  46. android:layout_width="250dp"
  47. android:layout_height="wrap_content"
  48. android:layout_alignParentTop="true"
  49. android:layout_centerHorizontal="true"
  50. android:layout_marginTop="24dp"
  51. android:hint="MailId"
  52. android:inputType="textEmailAddress" >
  53.  
  54. <requestFocus />
  55. </EditText>
  56.  
  57. <EditText
  58. android:id="@+id/editText2_passcode"
  59. android:layout_width="250dp"
  60. android:layout_height="wrap_content"
  61. android:layout_alignLeft="@+id/editText_mailId"
  62. android:layout_below="@+id/editText_mailId"
  63. android:layout_marginTop="23dp"
  64. android:hint="Password"
  65. android:inputType="textPassword" />
  66.  
  67. </RelativeLayout>
  68.  
  69.  
  70. "@drawable/login_alert_shape:::
  71.  
  72.  
  73. <?xml version="1.0" encoding="UTF-8"?>
  74. <shape xmlns:android="http://schemas.android.com/apk/res/android"
  75. android:shape="rectangle">
  76.  
  77. <gradient android:angle="45" android:endColor="#063F61"
  78. android:startColor="#1478B3" />
  79.  
  80. <padding android:bottom="10dp" android:left="10dp"
  81. android:right="10dp" android:top="10dp" />
  82.  
  83.  
  84.  
  85. </shape>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement