Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

import java.io.IOException;

import android.util.Log;

public class Main {
    /**
     * Create file if !exist
     * 
     * @param filePath
     *            The absolute file path we need to create
     * 
     * @throws IOException
     *             Input/Output exceptions
     */
    public static void createFile(File filePath) {
        if (!filePath.exists()) {
            try {
                filePath.createNewFile();
                Log.d("RDWR", "createFile: " + filePath);
            } catch (IOException e) {
                e.printStackTrace();
                Log.d("RDWR", "CreateFile: " + e.getMessage());
            }
        }
    }
}