Android Open Source - FisgoDroid Log Saver

From Project

Back to project page FisgoDroid.


The source code is released under:

The smiley icons bundled with this application belong to Meneame.NET and are licensed under the Creative Commons by-sa 3.0 license. For more information, please visit

If you think the Android project FisgoDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.meneame.fisgodroid;
//from w w  w . j  av a2 s  .c o  m
import java.util.Date;
import java.util.List;

import android.content.Context;
import android.text.format.DateFormat;
import android.widget.Toast;

public class LogSaver {
  private Context ctx;
  private List<ChatMessage> msgs;

  public LogSaver(Context context, List<ChatMessage> messages) {
    ctx = context;
    msgs = messages;

  public void save() {
    Toast resultToast = null;
    String logpath = null;

    File log = new File(ctx.getExternalFilesDir(null), DateFormat.format(
        "'fisgona-'dd-MM-yy-kkmmss'.log'", new Date()).toString());

    PrintStream logStream;

    try {
      logpath = log.getCanonicalPath();

      logStream = new PrintStream(log);

      for (ChatMessage message : msgs) {

      resultToast = Toast.makeText(ctx,
          ctx.getText(R.string.save_successful), Toast.LENGTH_SHORT);
    } catch (IOException e) {
      resultToast = Toast.makeText(ctx,
          ctx.getText(R.string.save_failed), Toast.LENGTH_SHORT);
    } finally {;

Java Source Code List