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.net.HttpURLConnection;

import java.util.Map;

public class Main {
    private static HttpURLConnection addHeaders(HttpURLConnection urlConnection, Map<String, String> headers) {
        try {
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue();
                urlConnection.setRequestProperty(key, value);
            }
        } catch (Exception ex) {
            Log.e("addHeader ", ex.getMessage());
        }
        return urlConnection;
    }
}