I have a database table, my goal is to read in each of the values from the data table, then write them to a text file to be emailed. How should I go about accomplishing this?
public void FileWrite()
{
Cursor remindersCursor = mDbHelper.fetchAllReminders();
startManagingCursor(remindersCursor);
try
{ // catches IOException below
String[] from = new String[]{RemindersDbAdapter.KEY_TITLE};
final String TESTSTRING = new String(RemindersDbAdapter.KEY_TITLE + " ");
File sdCard = Environment.getExternalStorageDirectory();
File myFile = new File(sdCard, "test");
FileWriter writer = new FileWriter(myFile);
writer.append(TESTSTRING);
writer.flush();
writer.close();
Toast.makeText(TaskReminderActivity.this, "Program Successfully went through FileWrite!", Toast.LENGTH_LONG).show();
} catch(Exception e)
{
Toast.makeText(TaskReminderActivity.this, "Had Problems with file!", Toast.LENGTH_LONG).show();
Log.e("FileWrite", "Had Problems with file!", e);
}
}