title: Java classes - best practice with constructors (android)
body: <p>I've built a class and would like to include a constructor which will construct the class from a cursor which will point to an SQLite DB. </p>
  
  <p>I also have a database helper class which sits in the same package and has static variables which give labels to the columns in the cursor. </p>
  
  <p>Should I use these references in the the constructor of the class or is that bad practice? </p>
  
  <p>Thanks, 
  m</p>
  
  <p>here is a simple generic example asked for in the comments...</p>
  
  <pre><code>  public class carDbHelper  extends SQLiteOpenHelper{
        public static final int ROW_ID = 0;
        public static final int ROW_TYPE = 1;
  
        ...// all db helper code omitted
  
    }
  
  
   public class Car{
              private int id; 
              private String type; 
  
              public Car (Cursor c){
                 this.id = c.getInt(carDbHelper.ROW_ID);
                 this.id = c.getString(carDbHelper.TYPE_ID);
              }
  
          //Other code omitted
       }
  </code></pre>