Notice
Recent Posts
Recent Comments
Link
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

🌱 dreaming DiNO

[Kotlin] Webview Header추가하여 loadUrl 하기, 새창 막기 본문

Android/Android Studio

[Kotlin] Webview Header추가하여 loadUrl 하기, 새창 막기

MK_____ 2023. 3. 22. 14:14
@SuppressLint("SetJavaScriptEnabled")
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        BleDebugLog.i(logTag, "onViewCreated-()")

        val headers = HashMap<String, String>()
        headers["Authorization"] = App.prefs.getString("token", "no token")

        binding.webView.apply {
            loadUrl("$BASE_URL/test/activityListWebView", headers)
            webViewClient = WebViewClient() // 새창 막기
        }
    }