Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AlertDialog.Builder loginBuilder = new AlertDialog.Builder(this);
- loginBuilder.setCancelable(false)
- .setTitle("Login Panel");
- LayoutInflater inflater=getLayoutInflater();
- //adding the inflater object to the view
- View view=inflater.inflate(R.layout.login_form, null);
- final EditText emailId=(EditText)view.findViewById(R.id.editText_mailId);
- final EditText passCode=(EditText)view.findViewById(R.id.editText2_passcode);
- loginBuilder.setView(view);
- loginBuilder.setPositiveButton("Login", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- // TODO Auto-generated method stub
- //do something
- }
- });
- loginBuilder.setNegativeButton("Register", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- // TODO Auto-generated method stub
- makeAToast("You have to Register first");
- finish();
- }
- })
- .show();
- R.layout.login_form::
- <?xml version="1.0" encoding="UTF-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/relativeLayout1"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/login_alert_shape">
- <EditText
- android:id="@+id/editText_mailId"
- android:layout_width="250dp"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_centerHorizontal="true"
- android:layout_marginTop="24dp"
- android:hint="MailId"
- android:inputType="textEmailAddress" >
- <requestFocus />
- </EditText>
- <EditText
- android:id="@+id/editText2_passcode"
- android:layout_width="250dp"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/editText_mailId"
- android:layout_below="@+id/editText_mailId"
- android:layout_marginTop="23dp"
- android:hint="Password"
- android:inputType="textPassword" />
- </RelativeLayout>
- "@drawable/login_alert_shape:::
- <?xml version="1.0" encoding="UTF-8"?>
- <shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <gradient android:angle="45" android:endColor="#063F61"
- android:startColor="#1478B3" />
- <padding android:bottom="10dp" android:left="10dp"
- android:right="10dp" android:top="10dp" />
- </shape>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement