Aisha Alkateeb Aisha Alkateeb - 1 year ago 87
Android Question

cannot resolve constructor 'class_name(java.lang.String)'

I'm trying to store data in database when clicking add button but an error appears when I created an object in class with database class as shown enter image description here

Answer Source

Ok. If you want to make this work, add a constructor something like this:

public class Database {
   public Database(String abc){
    //blah blah

And follow naming conventions - Class names should start with capital letters. Constructors should do the same thing. And its not just humans who'll have a problem with this, IDEs will poke you about this as well. So the code you've written should look like this:

Database database = new Database(course.getText());
Database database1 = new Database("xyz");

For naming conventions, refer to

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download