Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.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 如何通过&引用;下面给出了id为我的URL的android URL_Java_Android_Retrofit_Retrofit2 - Fatal编程技术网

Java 如何通过&引用;下面给出了id为我的URL的android URL

Java 如何通过&引用;下面给出了id为我的URL的android URL,java,android,retrofit,retrofit2,Java,Android,Retrofit,Retrofit2,我的网址 这里17是我想要手动传递的id 我的界面是 String BASE_URL = "http://74.207.233.160/api/v1/"; 但是当我运行它时,url是以这种格式显示的 “” 你能帮我解决这个问题吗?你的字符串是部分url编码的,请尝试使用 String afterDecode=urldecode.decode(,“UTF-8”); 我不确定您的使用情况,但改型有一些方法可以处理这个问题,我认为对于这个特定的情况来说似乎更好 我会这样做的界面: String af

我的网址

这里
17
是我想要手动传递的id

我的界面是

String BASE_URL = "http://74.207.233.160/api/v1/";
但是当我运行它时,url是以这种格式显示的 “”


你能帮我解决这个问题吗?

你的字符串是部分url编码的,请尝试使用

String afterDecode=urldecode.decode(,“UTF-8”);

我不确定您的使用情况,但改型有一些方法可以处理这个问题,我认为对于这个特定的情况来说似乎更好

我会这样做的界面:

String afterDecode = URLDecoder.decode(<your string>, "UTF-8");
公共接口MyCandidateApi{ @获取(“候选人”) 呼叫配对候选人( @查询(“作业”)int user_id, @标题(“授权”)字符串令牌 ); } 与此类似,
候选者
自动添加到路径中,以及查询参数
作业
。这样,您就不必担心对参数进行编码,甚至不必将其转换为字符串。改装为你做


这假设您根本不想对其进行编码。从您的问题判断,这是需要的行为。

仅供参考,
%3F
的URL编码形式。然后我没有得到输出。mm
encoded=true
应禁止将
转换为
%3F
,如所示。你能展示你代码的其他部分吗?
Integer id = 17;
String user_id = "candidates?job="+id;
String afterDecode = URLDecoder.decode(<your string>, "UTF-8");
public interface MyCandidateApi {

  @GET("candidates")
  Call<MyJobs> matchingcandidates(
    @Query("job") int user_id,
    @Header("Authorization") String token
  );
}