0% found this document useful (0 votes)
18 views3 pages

PR 27

Uploaded by

SAMMED PATIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

PR 27

Uploaded by

SAMMED PATIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

• .

xml File:-
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="3dp"
android:layout_y="12dp"
android:text="Username:-"
android:textSize="20dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/e1"
android:layout_x="109dp"
android:layout_y="-5dp"
android:text="Enter Your Username:-"
android:textSize="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="1dp"
android:layout_y="61dp"
android:id="@+id/t2"
android:text="Password:-"
android:textSize="20dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="108dp"
android:layout_y="50dp"
android:id="@+id/e2"
android:text="Enter Your Password:-"
android:textSize="20dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="91dp"
android:layout_y="111dp"
android:id="@+id/b1"
android:text="submit"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="14dp"
android:layout_y="171dp"
android:text=""
android:textSize="20dp"
android:id="@+id/t3"/>
</AbsoluteLayout>

• .java File:-
package com.example.pr_27;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


Button b1;
EditText e1,e2;
TextView t1,t2,t3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=(Button)findViewById(R.id.b1);
t1=(TextView) findViewById(R.id.t1);
t2=(TextView) findViewById(R.id.t2);
t3=(TextView) findViewById(R.id.t3);
e1=(EditText) findViewById(R.id.e1);
e2=(EditText) findViewById(R.id.e2);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(e1.getText().toString().equals("admin123") &&
e2.getText().toString().equals("ADMIN@123"))
{
Toast.makeText(MainActivity.this, "Login Successful...!",
Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(MainActivity.this, "Login UnSuccessful...!",
Toast.LENGTH_SHORT).show();
}
}
});
}
}

• O/p:-

You might also like