๋ชฉ๋กDEVELOPE (113)
๐ฑ dreaming DiNO
@SuppressLint("SetJavaScriptEnabled") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) BleDebugLog.i(logTag, "onViewCreated-()") val headers = HashMap() headers["Authorization"] = App.prefs.getString("token", "no token") binding.webView.apply { settings.javaScriptEnabled = true settings.loadWithOverviewMode = true settings.useWid..
@SuppressLint("SetJavaScriptEnabled") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) BleDebugLog.i(logTag, "onViewCreated-()") val headers = HashMap() headers["Authorization"] = App.prefs.getString("token", "no token") binding.webView.apply { loadUrl("$BASE_URL/test/activityListWebView", headers) webViewClient = WebViewClient()..

๋ฌธ์ ๋ฐ์ Postman ๋ api ๊ฐ ์ ๋๋ค. iOS๋ ์ ๋๋ค. ๊ทผ๋ฐ ๋๋ง ์๋๋ค. Okhttp log๋ฅผ ๋ณด๋ ์๊พธ 500 Error ๊ฐ ๋จ์ด์ก๋ค. ํ๋ผ๋ฏธํฐ๋ฅผ ์ ๋ชป๋ด์ ๋ณด๋ผ ๋๋ ์ ๋ฌ๋๋ฐ, ์ํผ ๋ค ๋๋๋ฐ ๋๋ง ์๋๋๊ฑฐ๋ฉด ๋ ํธ๋กํ์ผ๋ก ๋ณด๋ผ ๋์ ๋ฌธ์ ๊ฐ ์๋ค๋ ๊ฒ์ด๋ค. Content-Type : application/json; charset=UTF-8 ์ด ๋ฌธ์ ์๋ค. ์์ ํ๋ก์ ํธ POST ๋ฐฉ์๊ณผ ๋น๊ตํด๋ณด๋, ์์ ๋ช ์์ ์ผ๋ก Content-Type ์ application/json ์ผ๋ก ๋ฃ์ด์ ๋ณด๋ด์ฃผ์๋ค. @Hearders ๋ฏธ์ ๋ ฅ -> POST http://1.214.117.218:8888/login 2023-03-16 09:55:51.843 30434-30520 I/okhttp.OkHttpClien..
find() ํจ์ ์ฌ์ฉ ์์ผ๋ฉด ๊ทธ ๊ฐ๋ง return ์์ผ๋ฉด null return fun main(args: Array) { val list = arrayListOf("apple", "banana", "ananas") val firstItem = list.find { it == "mango" } val secondItem = list.find { it == "banana" } System.out.println(firstItem) // null System.out.println(secondItem) // banana }

๋ฌธ์ ๋ฐ์ com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 10 path $. ๋ฌธ์ ํด๊ฒฐ Retrofit ๊ฐ์ฒด ์ด๊ธฐํ ํ๋ ๊ณณ์์, GsonConverterFactory.create() ์์ GsonBuilder().setLenient().create() ๋ฅผ ๋ฃ์ด์ค๋ค ์์ ์ private val retrofit: Retrofit = Retrofit.Builder() .addCallAdapterFactory(ResponseAdapterFactory()) .baseUrl(BASE_URL) .client(okHttpClient) .addCon..
์ฌ์ฉ์๊ฐ ์ ํํ Local data ๋ฅผ ์ญ์ ํ๋ ๊ณผ์ ๋ฐฉ๋ฒ 1. 1. file name ๋ง ๋ค์ด๊ฐ ์๋ ์๋ก์ด arrayList() ์ ๋ง๋ ๋ค. 2. arrayList.contains ๋ฅผ ํ์ฉํ๋ค. private fun deleteLocalData(selectedList: ArrayList) { BleDebugLog.i(logTag, "deleteLocalData-()") val selectedNameList = ArrayList() selectedList.forEach { selectedNameList.add(it.name) } val directory = File(path) val files = directory.listFiles() files?.forEach { file -> if (file.is..

private var csvDataList = ArrayList() sortArray(csvDataList) private fun sortArray(csvDataList: ArrayList) { csvDataList.sortWith { o1, o2 -> o1.name.compareTo(o2.name) } BleDebugLog.d(logTag, "this.csvDataList (sorting): ${this.csvDataList}") csvDataList.reverse() BleDebugLog.d(logTag, "this.csvDataList (reverse): ${this.csvDataList}") }

1. Data Class ๋ฅผ ๋ง๋ค์ด์ค๋ค. val requestData = RequestEmailPwData(email, pw) 2. Gson ์ ์ด์ฉํด jsonString ์ ๋ง๋ค์ด์ค๋ค. val jsonString = Gson().toJson(requestData) 3. jsonString -> jsonObject ์ผ๋ก ๋ง๋ค์ด์ค๋ค. val jsonObject = JSONObject(jsonString) ํ ์ค๋ก ์ค์ฌ๋ณด๊ธฐ val requestJsonData = JSONObject(Gson().toJson(RequestEmailPwData(email, pw))) log ์์์๋ ๋๊ฐ์ด ๋ณด์ธ๋ค.
private fun toAppDetailSetting(context: Context) { try { //Open the specific App Info page: val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) intent.data = Uri.parse("package:" + context.packageName) context.startActivity(intent) } catch (e: Exception) { e.printStackTrace() //Open the generic Apps page: val intent = Intent(Settings.A..
์๋๋ก์ด๋์์ ํ์ฌ ๊ธฐ๊ธฐ์ ์ด ์ ์ฅ ์ฉ๋๊ณผ ์ฌ์ฉ ๊ฐ๋ฅํ ์ฉ๋์ด ์ด๋์ ๋ ํ์ธํ๊ธฐ ์ํด์๋ StatFs ํด๋์ค๋ฅผ ์ฌ์ฉ StatFs๋ file system์ ์ ๋ณด๋ฅผ ์ ๋ฌํด์ฃผ๋ ํด๋์ค๋ก, ์ ๋ณด๋ฅผ ์๊ธฐ ์ํ๋ ๊ฒฝ๋ก๋ฅผ ๋ฃ์ด ์์ฑํ ์ ์์ต๋๋ค. ๋ด๋ถ์ ์ฅ์์ ์ธ๋ถ์ ์ฅ์์ ์ฉ๋์ ์๊ณ ์ถ์ ๊ฒฝ์ฐ, ๊ฐ๊ฐ์ ๊ฒฝ๋ก๋ฅผ ๊ตฌํ๋ ์ฝ๋๋ฅผ ๋ฃ์ด์ค๋๋ค. ์ธ๋ถ์ ์ฅ์ : getDataDirectory() ๋ด๋ถ์ ์ฅ์ : getExternalStorageDirectory() fun getExternalMemory() { BleDebugLog.i(logTag, "getExternalMemory-()") val externalMemory = checkExternalStorageAllMemory() val externalAvailableMemo..