title: display database in textview based in query
body: <p>sorry if i'm asking simple Q at here but i have no idea to do it. i want to display data from SQLite database in textview based on the query. i already try some example but i dont know why te data do not appear. i try example from <a href="http://www.vogella.com/articles/AndroidSQLite/article.html" rel="nofollow noreferrer">http://www.vogella.com/articles/AndroidSQLite/article.html</a> and <a href="https://stackoverflow.com/questions/9460358/how-to-fetch-a-value-from-the-database-and-display-it-in-a-text-view-in-android">How to fetch a value from the database and display it in a text view in android</a>. can som1 tell me whats wrong with it? this is my code to query the data. tq..</p>
  
  <pre><code>RelativeLayout main=(RelativeLayout)findViewById(R.id.act);
  
      try
      {
          db = this.openOrCreateDatabase("todotable.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
  
          Cursor c=db.rawQuery("SELECT category, name, description FROM " +
                  todo + " where date = CURRENT_DATE", null);
          int column1=c.getColumnIndex("category");
          int column2=c.getColumnIndex("name");
          int column3=c.getColumnIndex("description");
          c.moveToFirst();
          if(c!=null)
          {   
              do
              {
                  String category=c.getString(column1);
                  String name =c.getString(column2);
                  String description = c.getString(column3);
                  //String category;
                  //String description;
                  data=data+category+" "+name+" "+description;
                 // Data1=Data1+Score+"\n";
                  System.out.println("cat "+category+" name "+name + " des "+description);
              }while(c.moveToNext());
              TextView tv=(TextView)findViewById(R.id.show);
  
              // TextView points=(TextView)findViewById(R.id.points);
              tv.setText(data);
              //points.setText(Data1);
              setContentView(R.layout.activity_crespro);
  
              }
  </code></pre>