@Override protected void onPostExecute(String sResponse) { try { if (pDialog.isShowing()) pDialog.dismiss(); if (sResponse != null) { Common.showDialog(BarcodeDemoActivity.this, sResponse); } } catch (Exception e) { Common.showDialog(BarcodeDemoActivity.this, e.getMessage()); Log.e(e.getClass().getName(), e.getMessage(), e); } }
private void writeFile(String data, String FileName) { if (!Common.checkSDCard()) { Common.showDialog(BarcodeDemoActivity.this, Common.getResText(this, R.string.no_sdcard)); return; } File root = new File( android.os.Environment.getExternalStorageDirectory().toString() + File.separator + "WinmateBarcode" + File.separator); if (!root.exists()) root.mkdirs(); FileWriter filewriter = null; BufferedWriter out = null; try { if (!root.canWrite()) Common.showDialog( BarcodeDemoActivity.this, Common.getResText(this, R.string.write_file_err)); File file = new File(root, FileName); filewriter = new FileWriter(file); out = new BufferedWriter(filewriter); out.write(data); out.flush(); } catch (Exception e) { Log.i(TAG, e.toString()); e.printStackTrace(); } finally { try { filewriter.close(); out.close(); } catch (IOException e) { Log.i(TAG, e.toString()); e.printStackTrace(); } } }