im newbie in android development and i try to make some login page..so im getting error of my login activity..its says that the method is not aplicable blablabla..and i’ve changed the code and its still not working..
so here my code..
loginform.java
public void onClick(View v) {
String username=akun.getText().toString();
String password1=password.getText().toString();
try{
if(username.length() > 0 && password1.length() >0)
{
Toko dbUser = new Toko();
dbUser.open();
if(dbUser.Login(akun, password))
{
Toast.makeText(LoginForm.this, "Success !",Toast.LENGTH_LONG).show();
}
else
Toast.makeText(LoginForm.this, "cok !",Toast.LENGTH_LONG).show();
//dbUser.close();
}
}catch(Exception e)
{
Toast.makeText(LoginForm.this,"cok ! 2", Toast.LENGTH_LONG).show();
}
}
toko.java
public boolean Login(String akun, String password) throws SQLException
{
Cursor C = db.rawQuery("SELECT * FROM toko WHERE akun=? AND password=?",new String[] {akun, password});
if (C != null) {
if(C.getCount() > 0)
{
return true;
}
}
return false;
}
so the error is here :
if(dbUser.**Login**(akun, password))
its says that The method Login(String, String) in the type Toko is not applicable for the arguments (EditText, EditText)
i believe that the error is corespond with the bold text :
public boolean Login(**String akun, String password**) throws SQLException
{
Cursor C = db.rawQuery("SELECT * FROM toko WHERE akun=? AND password=?",new >String[] {akun, password});
if (C != null) {
if(C.getCount() > 0)
{
return true;
}
}
return false;
}
so whats the problem with my code?
Here you pass the EditText objects, not the username and password
It should be the Strings