Reputation: 941
I have my Android App that does a POST on my WEB API http://<myip>:6262/api/values
. Then gets from the response body a string like this http://<myip>:8082/Folder/index.htlm
. Then I load my WebView
with the response of the WEB API.
I can access my server everywhere, ports are open (both 6262 and 8082 for UDP and TCP, and firewall does allow in and outbound connections for them)
I'm in a AsyncTask:
protected Void doInBackground(Void... params) {
mContext.runOnUiThread(new Runnable() {
@Override
public void run() {
mWebView.loadUrl("http://<myip>:8082/Folder/index.htlm");
}
});
}
Nothing loads, I got a blank view. Even if I loadUrl
in OnCreate()
.
But if I use http://google.com
it works...
I tried to load http://<myip>:8082/Folder/index.htlm
inside chrome in the phone and it worked. Any idea why it won't load inside the app?
Upvotes: 0
Views: 173
Reputation: 8471
try this
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test1);
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
return super.shouldOverrideUrlLoading(view, request);
}
});
myWebView.loadUrl("https://google.com");
}
Upvotes: 1