• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

webview with localhost

Hello Every one
I have made a webview with kotlin and every things work fine, but when i try to load mylocalhost:
http://127.0.0.1:3000/index.html

It wont load the localhost. Its fine with eg: http://www.dr.dk . I have tried to change in the settings, and i says "succes" :):

Code:
package com.example.test

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*


class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    webview.loadUrl("http://xxx.xxx.x.xxx:3000")

    }
}

When I start my local wevbserver:

Starting up http-server, serving ./
Available on:
http://xxx.xxx.x.xxx:3000 Im using this one
http://127.0.0.1:3000

And in my settings:

android-kotlin-webview.png


Regards Lars
 
Back
Top Bottom