Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.util.Log;
import java.io.File;

import java.io.PrintWriter;

import java.io.StringWriter;

public class Main {
    public static String getFileName(String path) {
        String rst = null;
        try {
            File f = new File(path);
            rst = f.getName();
        } catch (Exception e) {
            printE("OpusTool", e);
        }
        return rst;
    }

    public static void printE(String tag, Exception e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        Log.e(tag, sw.toString());
    }
}