encode URI by replacing string - Android android.net

Android examples for android.net:Uri

Description

encode URI by replacing string

Demo Code

import android.net.Uri;

public class Main{

    public static String encodeURI(String encoded) {
        encoded = encoded.replace("(", "%28");
        encoded = encoded.replace(")", "%29");
        encoded = encoded.replace("!", "%21");
        encoded = encoded.replace("\'", "%27");
        encoded = encoded.replace("*", "%2A");
        return encoded;
    }//from   ww  w.  j a  va  2  s  .  c om

}

Related Tutorials