I am trying to use the delegation design pattern in my android application but not sure whether I am doing it correctly or not. Here is my code for LoginActivity.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
public void login(View v) {
AutoCompleteTextView emailInput = (AutoCompleteTextView) findViewById(R.id.email);
EditText passwordInput = (EditText) findViewById(R.id.password);
String email = emailInput.getText().toString();
String password = passwordInput.getText().toString();
new ConnectDatabase().authenticate(email, password);
}
and here is my ConnectDatabase.java
delegator
public class ConnectDatabase {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public boolean authenticate(String email, String password) {
Log.d("Message", email+" &"+password);
return false;
}
}
Is it the correct way of using the design pattern or I have to make a interface and then let the LoginActivity.java
implement it?