Le code (avec tout les logs pour savoir pourquoi ca veut pas x))
import android.os.Environment;
import android.util.Log;
import java.io.File;
public class VideoMover implements Runnable {
private File _dirPath;
private String _filePath;
private String _oldPath;
private boolean _isSuccess;
public VideoMover(String path, int vitesse, String date)
{
this._dirPath = new File(Environment.getExternalStorageDirectory(), "/Dir/");
if (!this._dirPath.exists()) {
Log.e("Dir", "doesn't exist");
this._dirPath.mkdir();
}
if (!this._dirPath.canWrite()) {
Log.e("Dir", "can't write");
}
this._filePath = "/" + String.valueOf(vitesse) + "_" + date.replace(' ', '_') + ".mp4";
this._oldPath = path;
Log.e("dirPath", this._dirPath.getPath());
Log.e("filePath", this._filePath);
Log.e("oldPath", this._oldPath);
}
@Override
public void run() {
Log.e("VideoMover", "move");
File move = new File(this._oldPath);
if (!move.canRead()) {
Log.e("move", "can't read");
}
if (!move.exists()) {
Log.e("move", "doesn't exist");
}
this._isSuccess = move.renameTo(new File(this._dirPath, this._filePath));
if (_isSuccess) {
Log.e("VideoMover", "success");
}
else
Log.e("VideoMover", "failed");
}
}
Merci d'avance !
- Edité par twx 3 juin 2013 à 17:39:30
Deplacer un fichier -> Impossible...
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.