You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2021. It is now read-only.
private fun settingImgMultiPart(): MultipartBody.Part {
val options = BitmapFactory.Options()
val inputStream = contentResolver.openInputStream(CatInfoData.catProfileUri!!)!!
val bitmap = BitmapFactory.decodeStream(inputStream, null, options)
val byteArrayOutputStream = ByteArrayOutputStream()
bitmap!!.compress(Bitmap.CompressFormat.JPEG, 20, byteArrayOutputStream)
val photoBody =
RequestBody.create(MediaType.parse("image/jpg"), byteArrayOutputStream.toByteArray())
return MultipartBody.Part.createFormData(
"profileImg",
File(CatInfoData.catProfileUri.toString()).name,
photoBody
)
}
나머지 String 값은 HashMap으로 설정
val name = RequestBody.create(MediaType.parse(PARSE_STRING), CatInfoData.profileName)
...
mOunce.SERVICE.postCatProfile(
token = accessToken,
profileImg = pictureRb,
body = hashMapOf<String, RequestBody>(
"profileName" to name,
"profileWeight" to weight,
"profileGender" to gender,
"profileNeutral" to neutral,
"profileAge" to age,
"profileInfo" to info
)
).customEnqueue ....