-1
如何從WebView中的字符串值加載數據?我試試這個:如何從WebView中的字符串加載數據
web.loadData(getResource().getString(R.string.webdata), "text/html","UTF-8");
但它會得到錯誤。請幫幫我。
如何從WebView中的字符串值加載數據?我試試這個:如何從WebView中的字符串加載數據
web.loadData(getResource().getString(R.string.webdata), "text/html","UTF-8");
但它會得到錯誤。請幫幫我。
試試這個
WebView webview = (WebView)this.findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadDataWithBaseURL("", data, "text/html", "UTF-8", "");
請解釋,**詳細**,什麼是 「它得到錯誤」 的意思。另外,請提供您已定義'webdata'的字符串資源文件。 – CommonsWare
我說得到錯誤,因爲它強制關閉,並且webdata包含html代碼。像
– user7720433「我說錯誤,因爲它強制關閉」 - 然後使用LogCat檢查與您的崩潰相關的Java堆棧跟蹤:http://stackoverflow.com/questions/23353173/uncomfort-myapp-has-stopped-how - 可以-I-解決 - 這一點。另外,請注意您的HTML無效。 – CommonsWare