Last active
March 12, 2022 22:44
-
-
Save esantiago1/493cd1e2b8597f02c75e8a8a510e7ccb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ApiClientInterface { | |
@Multipart | |
@POST("xxxx") | |
Call<ResponseBody> serviceLogin(@PartMap Map<String, RequestBody> params); | |
} | |
.......... | |
ApiClientInterface mApiClientInterface= ApiClient.getInstance().create(ApiClientInterface.class); | |
RequestBody body = RequestBody.create(MediaType.parse("text/plain"), "value"); | |
Map<String, RequestBody> requestBodyMap = new HashMap<>(); | |
requestBodyMap.put("key", body); | |
Call<ResponseBody> response=mApiClientInterface.serviceLogin(requestBodyMap); | |
userRCall.enqueue(................); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiClient { | |
private static final String URL = ""; | |
private static Retrofit mRetrofit = null; | |
public static Retrofit getInstance() { | |
if (mRetrofit == null) { | |
mRetrofit = new Retrofit.Builder() | |
.baseUrl(URL) | |
.build(); | |
} | |
return mRetrofit; | |
} | |
} |
string that you need to server...
don't forget to use scalar converter in your retrofit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is
"value"
here??