btnSave.setOnClickListener(new View.OnClickListener() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date now = new Date(); String fileName = "TFR_"+formatter.format(now) + ".txt";//like 2016_01_12.txt @Override public void onClick(View v) { try { File root = new File(Environment.getExternalStorageDirectory()+ "Dhananjay", "A1"); if (!root.exists()) { root.mkdirs(); root.createNewFile(); } File gpxfile = new File(root, fileName); FileWriter writer = new FileWriter(gpxfile,true); writer.write(tvTerminal.getText()+"\n\n"); writer.flush(); writer.close(); clear.setVisibility(View.VISIBLE); } catch(IOException e) { e.printStackTrace(); } } });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)