Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.net.URLEncoder;

import android.util.Log;

public class Main {
    private static String mLogTag = "DebugUtils";
    private static boolean mIsDebug = false;

    public static String toURLEncoded(String paramString) {
        if (paramString == null || paramString.equals("")) {
            LogD("toURLEncoded error:" + paramString);
            return "";
        }

        try {
            String str = new String(paramString.getBytes(), "UTF-8");
            str = URLEncoder.encode(str, "UTF-8");
            return str;
        } catch (Exception localException) {
            LogE("toURLEncoded error:" + paramString, localException);
        }

        return "";
    }

    public static void LogD(String msg) {
        if (mIsDebug) {
            Log.d(mLogTag, msg);
        }
    }

    public static void LogE(String msg, Exception e) {
        Log.e(mLogTag, msg, e);
        e.printStackTrace();
    }
}