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 android.os.Bundle;

public class Main {
    public static String encodeUrl(Bundle parameters) {
        return encodeUrl(parameters, true);
    }

    public static String encodeUrl(Bundle parameters, boolean sep) {
        String query = "";
        int x = 0;
        for (String key : parameters.keySet()) {

            String q = "?";
            if (sep == false)
                q = "&";
            query += (x == 0 ? q : "&") + key + "=" + parameters.getString(key);
            x++;

        }

        return query;

    }
}