title: How to create a database class object inside a fragment
body: <p>I have a fragment that needs to connect to the database to view its contents and in order to do that I need to get a cursor to my database. Now I have a database class as "DB" and a fragment class "FRAG" . To get a cursor I need to call certain methods of "DB" class inside my fragment. Now to call a method of "DB" class I need a object of "DB" class, the problem is that I am unable to initialize a constructor of "DB" class in fragment class. <br><br>Syntax is as follows- 
  <br> Original database constructor is <br></p>
  
  <pre><code>public DB(Context context, String name, CursorFactory factory,int version) {
          super(context,"database", factory,1);
      }
  </code></pre>
  
  <p><br><br>
  I am initializing its object in fragment as follows-<br></p>
  
  <pre><code>DB ob=new DB(this,"database",null,1);
  </code></pre>
  
  <p><br><br>
  It gives me a syntax error as -<br></p>
  
  <pre><code>The constructor DB(Frag, String, null, int) is undefined
  </code></pre>
  
  <p><br>
  How do I initialize a object in this case. Kindly help.</p>