2013-04-24 172 views
0

我遇到與SharePoint站點有關的問題。 我已經給它的身份驗證它的ntlm身份驗證,並將整個網站轉換爲一個字符串, 和一旦我加載到WebView使用loadData();我看不到圖像。我認爲它與.axd文件擴展有關,因爲它隱藏了圖像的完整url。Android Webview無法加載Sharepoint網站

+0

嘗試用'loadDataWithBaseURL'加載數據,而不是使用'loadData' – Zyber 2013-04-24 07:54:07

+0

@Zyber,我想,前一段時間,但圖像不加載,是換成一個問號。 – 2013-04-24 08:00:27

回答

0

我知道如何解決它:

package com.example.yourapp; 


import android.annotation.SuppressLint; 
import android.app.Activity; 
import android.net.http.SslError; 
import android.os.Bundle; 

import android.webkit.*; 


@SuppressLint({ "SetJavaScriptEnabled", "NewApi" }) 
public class Sharepoint extends Activity { 

    private WebView webView; 

    @SuppressLint("NewApi") 
    public void onCreate(Bundle savedInstanceState) { 

     super.onCreate(savedInstanceState); 
     setContentView(R.layout.sharepoint); 
     CookieSyncManager.createInstance(this); 

     CookieManager cookieManager = CookieManager.getInstance(); 
     String cook = null; 
     cookieManager.setCookie("yoursite", cook); 
     CookieSyncManager.getInstance().sync(); 
     webView = (WebView) findViewById(R.id.webView); 
     webView.setWebViewClient(new WebViewClient() 
     { 
      public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) 
      { 
       handler.proceed(); 
      } 

      public void onProgressChanged(WebView view, int progress) 
      { 

      } 
     }); 
     webView.getSettings().setDomStorageEnabled(true); 
     webView.getSettings().setAllowContentAccess(true); 
     webView.getSettings().setAllowFileAccess(true); 
     webView.getSettings().setAllowUniversalAccessFromFileURLs(true);   webView.getSettings().setLoadsImagesAutomatically(true); 
     webView.getSettings().setBuiltInZoomControls(true); 
     webView.getSettings().setJavaScriptEnabled(true); 
     webView.getSettings().setAppCacheEnabled(true); 

     try { 
      Thread.sleep(300); 
     } catch (InterruptedException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     webView.loadUrl("yoururl"); 




    } 

}