0

firstly excuse me because of my bad english.. I'm preparing an android application by using webview..

I Can Load Html file from assets folder but When I try load an .aspx file from assets folder. its being failed.. how can I do this ? When I Lauch My Project Webview Looks Like This https://i.stack.imgur.com/eEXYF.png

http://puu.sh/ihyQr/05a420bed4.png

  • 1
    `how to load aspx file in a webview from assets folder`... It's **not possible**. An aspx (Active **Server** Page eXtended) page exists **only on a server**. you can load dhtml pages, instead. – Phantômaxx Jun 08 '15 at 22:30
  • possible duplicate of [Loading an Android resource into a webview](http://stackoverflow.com/questions/4855008/loading-an-android-resource-into-a-webview) – Dan S Jun 08 '15 at 22:32

1 Answers1

3

The .aspx will not work, because can´t be executed, you will load an HTML file instead containig JavaScript, using loadUrl() method of your WebView:

    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);  
        WebView wv;  
        wv = (WebView) findViewById(R.id.webView);  
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        wv.loadUrl("file:///android_asset/hello.html");   
    }  
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
  • Side note: you'll be warned for a security issue (becuse JavaScript is **evil**!). Simply add the `SuppressWarning` annotation to the `onCreate()` method. – Phantômaxx Jun 09 '15 at 07:55