title: Displaying Toast messages in text view
body: <p>I am using SQLite database to store and retrive data to my android application. In the following code I have retrived my table data to my screen using a toast message. I wanted to display all the records to my screen in textview. I am helpless in where to do changes. Would be really helpfull if somebody can help me with this code. Tried number of options and failed.</p>
  
  <p>This is my main activity.</p>
  
  <pre><code>public class MainActivity extends Activity {
  protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          DatabaseHandler db = new DatabaseHandler(this);
  
               try {
          String destPath = "/data/data/" + getPackageName()
                  + "/databases/questions";
          File f = new File(destPath);
          if (!f.exists()) {
              CopyDB(getBaseContext().getAssets().open("questions"),
                      new FileOutputStream(destPath));
          }
      } 
  
               catch (FileNotFoundException e) {
          e.printStackTrace();
          Toast.makeText(MainActivity.this, "Error File", Toast.LENGTH_SHORT)
                  .show(); 
      } 
               catch (IOException e1) {
          e1.printStackTrace();
         Toast.makeText(MainActivity.this, "Error IO", Toast.LENGTH_SHORT)
                  .show();
      }
  
   Cursor cursor = db.getAllQuestions();
          if (cursor.moveToFirst())
          {
              do {
                  DisplayRecord(cursor);
  
              }
              while(cursor.moveToNext());
          }
  
          db.close();
      }
  
          public void CopyDB(InputStream inputstream, OutputStream outputstream)        
                  throws IOException {
              byte[] buffer = new byte[1024];
              int length;
              while ((length = inputstream.read(buffer))&gt;0){
                  outputstream.write(buffer, 0, length);
              }
              inputstream.close();
              outputstream.close();
          }
  
          public void DisplayRecord(Cursor cursor){
              Toast.makeText(this,
                      "id:" + cursor.getString(0) + "\n" +
                      "Question:" + cursor.getString(1) + "\n" +
                      "Answer:" + cursor.getString(2),
                      Toast.LENGTH_SHORT).show();
  
  
          }
  }
  </code></pre>
  
  <p>Thanks in advance</p>