Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.net.URLEncoder;

public class Main {
    public static String getUrlEncodeString(String key, String value) {
        String encodeStr = "";

        try {
            encodeStr = URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            Log.e("Encode Error", e.getMessage());
        }

        return encodeStr;
    }
}