Android Open Source - AutoHosts File Deleter






From Project

Back to project page AutoHosts.

License

The source code is released under:

MIT License

If you think the Android project AutoHosts 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 com.yeyaxi.AutoHosts;
/*from  w  w w . j a v  a  2 s . c  o  m*/
import android.os.AsyncTask;
import android.util.Log;

import java.io.File;

public class FileDeleter extends AsyncTask<String, Void, Boolean>
{
  private AutoHostsActivity caller;
  private int callbackMessage;
    private static final String TAG = FileDeleter.class.getSimpleName();

  public FileDeleter (AutoHostsActivity caller, int callbackMessage)
  {
    this.caller = caller;
    this.callbackMessage = callbackMessage;
  }

  @Override
  protected Boolean doInBackground (String... input)
  {
    File fileToDelete = new File(input[0]);
    if (fileToDelete != null && fileToDelete.isFile() && fileToDelete.canWrite())
      return fileToDelete.delete();
    return true;

  }

  @Override
  protected void onPostExecute (Boolean success)
  {
    Log.d(TAG, "Result for deleting file (" + callbackMessage + "): " + success);
    if (success)
    {
      caller.displayCalbackMessage(callbackMessage, R.string.append_success);
      caller.doNextTask();
    }
    else
      caller.displayCalbackErrorMessage(callbackMessage);
  }
}




Java Source Code List

com.yeyaxi.AutoHosts.AppendItemActivity.java
com.yeyaxi.AutoHosts.AutoHostsActivity.java
com.yeyaxi.AutoHosts.BaseActivity.java
com.yeyaxi.AutoHosts.CommandRunner.java
com.yeyaxi.AutoHosts.FileCopier.java
com.yeyaxi.AutoHosts.FileDeleter.java
com.yeyaxi.AutoHosts.RootChecker.java
com.yeyaxi.AutoHosts.SystemMount.java
com.yeyaxi.AutoHosts.UnableToMountSystemException.java
com.yeyaxi.AutoHosts.WebFileDownloader.java