(String data, Context context)
| 167 | } |
| 168 | |
| 169 | public static void writeToFile(String data, Context context) { |
| 170 | try { |
| 171 | String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath(); |
| 172 | String fileName = "myFile.txt"; |
| 173 | |
| 174 | File file = new File(baseDir + File.separator + fileName); |
| 175 | |
| 176 | FileOutputStream stream = new FileOutputStream(file); |
| 177 | try { |
| 178 | stream.write(data.getBytes()); |
| 179 | } finally { |
| 180 | stream.close(); |
| 181 | } |
| 182 | } catch (IOException e) { |
| 183 | Log.e("Exception", "File write failed: " + e.toString()); |
| 184 | } |
| 185 | } |
| 186 | } |
nothing calls this directly
no test coverage detected