I have my own internet site on localhost. The JSP page is working fine when I run the JSP files from NetBeans. also running fine when I run it from the browser. I made a simple Android application with a WebView. The application also runs fine when I try to load CNN site: But when I replace the URL with my own URL, I get the famous Error message: HTTP Status 404 - Not Found. I know that the URL is also fine because I can run it from the browser. The only difference is that my URL is on localhost. I'm using Android Emulator Nexus_6_API_23 Google_API:5554 I read in other's people answers that the emulator interact with localhost using IP 10.0.2.2, So I have changed the WebView URL as follow: from: http://localhost:8080/MissionWS/myLogin.jsp To: http://10.0.2.2:8080/MissionsWS/myLogin.jsp
Here is the code of the web view android application: Can anyone help?
public class MainActivity extends AppCompatActivity {
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.mWebView);
mWebView.getSettings().setJavaScriptEnabled(true);
//mWebView.loadUrl("http://edition.cnn.com/");
mWebView.loadUrl("http://10.0.2.2:8080/MissionsWS/myLogin.jsp");
}
}