I have written the following method in a class that inherits from the Thread class:
protected File createFile(String fileName){
try {
File file = new File(fileName);
if(!file.exists())
file.createNewFile();
else{
file.delete();
file.createNewFile();
}
file.mkdirs();
return file;
}catch (IOException e) {
e.printStackTrace();
return null;
}
}
It will be called from an Activity once the Thread has already started. If I do this from my Activity:
File logFile = mThread.createFile("/Logs/test.txt");
if(logFile!=null)
//do something
else
//do something else
Will it block until the file is created?