Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使url字符串变得复杂_Java_Android - Fatal编程技术网

Java 如何使url字符串变得复杂

Java 如何使url字符串变得复杂,java,android,Java,Android,创建android应用程序以从web服务器接收json格式的数据 在我的应用程序中,我应该将url作为字符串,并使用它获取如下数据 private static final String my_url = "http://example.com/folder/showJsonData.php"; jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, my_url ,new Response.Listener<JSONO

创建android应用程序以从web服务器接收json格式的数据
在我的应用程序中,我应该将url作为字符串,并使用它获取如下数据

private static final String my_url = "http://example.com/folder/showJsonData.php";
jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, my_url ,new Response.Listener<JSONObject>() {
.
.
.
}
private静态最终字符串my\u url=”http://example.com/folder/showJsonData.php";
jsonObjectRequest=newJSONObjectRequest(Request.Method.POST,my_url,new Response.Listener()){
.
.
.
}

正如您所见,我的url并不复杂,也没有编码,所以每个人都可以在反编译apk后访问它。
问题是我如何使它变得更复杂一点
请举例说明。

谢谢

URL编码在android上的实现方式与JavaSE相同

try {
    String url = "http://www.example.com/?id=123&art=abc";
    String encodedurl = URLEncoder.encode(url,"UTF-8");
    Log.d("TEST", encodedurl);
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
} 

可能存在重复的字符串url!您正在对其进行编码。如果任何人反编译应用程序将看到该行代码,您可以将url保存到数据库中,这肯定会对您有所帮助。