Skip to Content
Menu
This question has been flagged
3949 Views
package amachu.com.vvcoeloginpage;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


public class MainActivity extends AppCompatActivity {

String editTextUsername;
String editTextPassword;
Button button;
EditText editText1,editText2;
String password="Your password";
String status = "";
String db="vvcoe9";
//String url;
String url="http://example.com";

String username="username";


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText1 = (EditText) findViewById(R.id.username);
editText2= (EditText) findViewById(R.id.Password);
button = (Button) findViewById(R.id.btnlogin);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {



editTextUsername = editText1.getText().toString();
editTextPassword = editText2.getText().toString();
if ((editTextUsername.equals(username)) && (editTextPassword.equals(password))){

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
}
else {
status="Login failed";
}
}



//final String Name=editText.getText().toString();
//final String pass=password.getText().toString();
//if ((Name.equals()) && (pass.equals(myPass))) {


//} else {
// System.out.println("Username or password is wrong");
//}


});


}
}
Avatar
Discard
Related Posts Replies Views Activity
0
Nov 24
3
1
Jan 24
1180
1
Jul 23
1673
0
Oct 22
2190
0
Apr 22
2417