title: Retrieving data from SQLite database in another Activity
body: <p>I have created 3 activities including DBAdapter for database.
  One is for saving the data and another is for retrieving the data from the SQLitedatabase created in DBAdapter class.
  The creation of database has completed successfully.</p>
  
  <p>mainActivity code for saving:</p>
  
  <pre><code>DBAdapter db=new DBAdapter(this); 
  save=(Button)findViewById(R.id.save);
   save.setOnClickListener(new View.OnClickListener() 
          {
  
              public void onClick(View v) 
              {
                  try 
                  {
                      db.open();
                  } 
                  catch (SQLException e) 
                  {
                      e.printStackTrace();
                  }
                  String s=nme.getText().toString();
                  String em=email.getText().toString();
  
                  long id=db.insertContact(s,em);
                  Toast.makeText(DataActivity.this, "Saved", 20).show();
                  db.close();
              }
      });
  </code></pre>
  
  <p>For retrieving the data I created the object in another Activity called RetrieveActivity </p>
  
  <p>RetrieveActivity code for retrieving:</p>
  
  <pre><code>DBAdapter db=new DBAdapter(this);
          try {
              db.open();
          } catch (SQLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          srch.setOnClickListener(new View.OnClickListener() 
          {   
              public void onClick(View v) 
              {
                  Cursor c=db.getAllContacts();
                  no1.setText(c.getString(0));
                  nm1.setText(c.getString(1));
                  em1.setText(c.getString(2));
  
              }
          });
  
      db.close(); 
  </code></pre>
  
  <p>But while clicking the button for retrieving "Force to close command" occurred.
  My doubt is with creating the object for DBAdapter.Can I access the Created database with an object from other Activity..?</p>