private void clearSaved() { PrintWriter writer = null; try { writer = new PrintWriter("config.txt", "UTF-8"); writer.println("PhoneNumbers:"); writer.println("Items:"); results.setText("Config.txt has been cleared."); } catch (FileNotFoundException | UnsupportedEncodingException e1) { e1.printStackTrace(); } writer.close(); }