0% found this document useful (0 votes)
20 views2 pages

Loginjava

The document is a Java class for an Android login activity that handles user authentication. It checks if the username and password fields are filled, validates the credentials against hardcoded values, and navigates to a dashboard or shows error messages accordingly. Additionally, it provides a button to navigate to a signup activity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Loginjava

The document is a Java class for an Android login activity that handles user authentication. It checks if the username and password fields are filled, validates the credentials against hardcoded values, and navigates to a dashboard or shows error messages accordingly. Additionally, it provides a button to navigate to a signup activity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

package [Link].

activity4;

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class LogIn extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_log_in);

TextView username = (TextView) findViewById([Link]);


TextView password = (TextView) findViewById([Link]);
Button login = (Button) findViewById([Link]);
Button signup = (Button) findViewById([Link]);

[Link](new [Link]() {
@Override
public void onClick(View v) {
if([Link]().toString().isEmpty() ||
[Link]().toString().isEmpty()){
[Link](getApplicationContext(),"Please enter USN and
Password", Toast.LENGTH_SHORT).show();
}

else if([Link]().toString().equals("2019400551") &&


[Link]().toString().equals("1234")){
Intent login = new Intent([Link], [Link]);
startActivity(login);
onResume();
[Link](getApplicationContext(),"Welcome",
Toast.LENGTH_SHORT).show();
}
else{
[Link](getApplicationContext(),"Invalid USN /
Password", Toast.LENGTH_SHORT).show();
}

}
});

[Link](new [Link]() {
@Override
public void onClick(View v) {

Intent signup = new Intent([Link], [Link]);


startActivity(signup);
onResume();
}

});

}
}

You might also like