Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- btnlogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- String username = txt_username.getText().toString();
- String password = txt_password.getText().toString();
- ConnectionDetector conn = new ConnectionDetector();
- // mengecek kolom yang kosong
- if (username.trim().length() > 0 && password.trim().length() > 0) {
- if (conMgr.getActiveNetworkInfo() != null
- && conMgr.getActiveNetworkInfo().isAvailable()
- && conMgr.getActiveNetworkInfo().isConnected()) {
- if(conn.webTerhubung()){
- Toast.makeText(getApplicationContext() ,"Gagal terhubung ke server!", Toast.LENGTH_LONG).show();
- }else {
- checkLogin(username, password);
- }
- } else {
- Toast.makeText(getApplicationContext() ,"No Internet Connection", Toast.LENGTH_LONG).show();
- }
- } else {
- // Prompt user to enter credentials
- Toast.makeText(getApplicationContext() ,"Kolom tidak boleh kosong", Toast.LENGTH_LONG).show();
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement