0% found this document useful (0 votes)
68 views1 page

Package Import Import Import Import Import Import Import Public Class Extends Private Private Private

This Android code defines a login activity with a username and password field. When the login button is clicked, it gets the text from the fields and checks if it matches a hardcoded username and password. If it matches, a toast message is shown saying login succeeded, otherwise it shows login failed.

Uploaded by

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

Package Import Import Import Import Import Import Import Public Class Extends Private Private Private

This Android code defines a login activity with a username and password field. When the login button is clicked, it gets the text from the fields and checks if it matches a hardcoded username and password. If it matches, a toast message is shown saying login succeeded, otherwise it shows login failed.

Uploaded by

yunijelek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

package [Link].

dream1;

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

public class MainActivity extends AppCompatActivity {


private EditText uname;
private EditText pass;
private Button button;

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

uname = (EditText) findViewById([Link]);


pass = (EditText) findViewById([Link]);
button = (Button) findViewById([Link]);

[Link](new [Link]() {
@Override
public void onClick(View v) {
//variable untuk menyimpan
String username = [Link]().toString();
String password = [Link]().toString();

if ([Link] ("admin") && [Link]("admin"))


{
[Link]([Link],
"Selamat Anda Berhasil Login",
Toast.LENGTH_LONG).show();
} else{
[Link]([Link],
"Username dan/atau Password Salah !",
Toast.LENGTH_LONG).show();
}

/*[Link]([Link],
"Username : " + username + " Password : " +
password,
Toast.LENGTH_LONG).show();*/
}
});
}
}

You might also like