Writing listview contents to html file android -


i have listview being filled database. want take contents of listview , show in html table.

how can take listview , write contents html file?

i did similar here.

 private file saveresults() {     /*      * write results file.      */     list<riderresult> results = datamodel.get().getresults();      try {         if (!environment.media_mounted.equals(environment.getexternalstoragestate())) {             toast.maketext(summaryfragment.this.getcontext(), "unable access external storage.",                     toast.length_short).show();             return null;         }          /*          * create file folder in external storage.          */         file csvdir = new file(                 environment.getexternalstoragedirectory(),                 "android/data/ca.mydomain.myapp/results");         if (!csvdir.exists())             csvdir.mkdirs();          /*          * create file in folder, today's date , time name.          */         date datenow = new date ();         simpledateformat dateformatyyyymmdd = new simpledateformat("yyyymmddhhmm");         stringbuilder nowmmddyyyy = new stringbuilder( dateformatyyyymmdd.format( datenow ) );          file csvfile = new file(csvdir, "result_" + nowmmddyyyy + ".csv");          bufferedwriter bw = new bufferedwriter(new filewriter(csvfile, false));          /*          * write header row.          */         bw.write("finish seq, start num,clock time, actual time\n");          /*          * , row each result, comma separated          */         (int = 0; < results.size(); i++) {             string row = new string();             row = "" + (i + 1) + "," + results.get(i).getstartno()                     + "," + results.get(i).getclocktimestring() + ","                     + results.get(i).getactualtimestring() +"\n";             bw.write(row);         }          bw.close();            /*          *  return file user - use in message or email attachment.          */         return csvfile;      } catch (ioexception e) {         e.printstacktrace();         return null;     } } 

i writing file later attach email or send via bluetooth, or leave on file. file csv (race results) , name of file generated. can adapt use.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -