2013-08-17 19 views
2

我得到主題行中提到的錯誤,同時用共享的前提條件排除了webview。我也發佈了代碼和logcat。請告知我可能會出錯的地方?我基本上是試圖在網頁視圖中打開一個HTTPS站點,並使用共享偏好來自文件的不安全內容:///android_asset/webkit/android-weberror.png

package com.example.sharedpref; 



    import android.app.Activity; 
    import android.content.SharedPreferences; 
    import android.os.Bundle; 
    import android.util.Log; 
    import android.view.View; 
    import android.view.View.OnClickListener; 
    import android.webkit.WebChromeClient; 
    import android.webkit.WebView; 
    import android.webkit.WebViewClient; 
    import android.widget.Button; 
    import android.widget.EditText; 
    import android.widget.Toast; 
    import com.example.sharedpref.R; 

    public class MainActivity extends Activity implements OnClickListener { 


     private Button mSaveButton; 
     private Button mSaveButton1; 
     private EditText mInputidText; 
     private EditText mInputpwdText; 
     private WebView mWebView; 
     private WebChromeClient mWebchromeclient; 
     private WebViewClient mWebViewClient; 
     public static final String PREF_STRING = "https://kee.mahindrasatyam.com/_layouts/mobile/mobilesearch.aspx"; 


     @Override 
     protected void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.activity_main); 
      mWebView = (WebView) findViewById(R.id.webView1); 
      mInputidText = (EditText) findViewById(R.id.editText1); 
      mInputpwdText = (EditText) findViewById(R.id.editText2); 
      mSaveButton = (Button) findViewById(R.id.button1); 
      mSaveButton1 = (Button) findViewById(R.id.button2); 
       mSaveButton.setOnClickListener(this); 
       mSaveButton1.setOnClickListener(this); 

     } 

     @Override 
     public void onClick(View v) { 
      int id = v.getId(); 
      String message = ""; 

       if (id == R.id.button1){ 
        SharedPreferences sp=getPreferences(MODE_PRIVATE); 
       SharedPreferences.Editor Ed=sp.edit(); 
       Ed.putString("Unm", mInputidText.toString());    
       Ed.putString("Psw",mInputpwdText.toString()); 
       Ed.commit(); 
        message="Text Saved in Preferences"; 

        } 


       else if (id == R.id.button2){ 

        try{ 
        SharedPreferences sp1=getPreferences(MODE_PRIVATE);; 



       mWebView = new WebView(this) { 

       }; 
       mWebchromeclient = new WebChromeClient() { 

       }; 

       mWebView.setWebChromeClient(mWebchromeclient); 
       mWebView.setWebViewClient(mWebViewClient); 
       setContentView(mWebView); 

       /* Load the last saved preference. */ 
       mWebView.loadUrl(sp1.getString(PREF_STRING, "https://kee.mahindrasatyam.com/_layouts/mobile/mobilesearch.aspx"));   } 

       catch (Exception e) { 
        Log.i(" connect secon button exception:",""+PREF_STRING); 
         e.printStackTrace(); 
       } 

      Toast.makeText(this, message, Toast.LENGTH_LONG).show(); 
     } 



     }} 



Logcat: 
08-17 12:32:03.854: D/TextLayoutCache(16359): Using debug level: 0 - Debug Enabled: 0 
08-17 12:32:04.144: D/libEGL(16359): loaded /system/lib/egl/libGLES_android.so 
08-17 12:32:04.164: D/libEGL(16359): loaded /system/lib/egl/libEGL_adreno200.so 
08-17 12:32:04.184: D/libEGL(16359): loaded /system/lib/egl/libGLESv1_CM_adreno200.so 
08-17 12:32:04.194: D/libEGL(16359): loaded /system/lib/egl/libGLESv2_adreno200.so 
08-17 12:32:04.324: D/OpenGLRenderer(16359): Enabling debug mode 0 
08-17 12:32:07.124: D/chromium(16359): Unknown chromium error: -400 
08-17 12:32:07.204: D/dalvikvm(16359): GC_CONCURRENT freed 249K, 4% free 9001K/9287K, paused 3ms+7ms 
08-17 12:32:07.274: W/Web Console(16359): The page at https://kee.mahindrasatyam.com/_layouts/mobile/mobilesearch.aspx displayed insecure content from file:///android_asset/webkit/android-weberror.png. 
08-17 12:32:07.274: W/Web Console(16359): at null:1 
08-17 12:32:24.564: D/OpenGLRenderer(16359): Flushing caches (mode 1) 
08-17 12:32:24.564: D/OpenGLRenderer(16359): Flushing caches (mode 0) 
08-17 12:32:24.894: W/IInputConnectionWrapper(16359): showStatusIcon on inactive InputConnection 
08-17 12:37:14.944: D/TextLayoutCache(16676): Using debug level: 0 - Debug Enabled: 0 
08-17 12:37:15.004: D/libEGL(16676): loaded /system/lib/egl/libGLES_android.so 
08-17 12:37:15.014: D/libEGL(16676): loaded /system/lib/egl/libEGL_adreno200.so 
08-17 12:37:15.014: D/libEGL(16676): loaded /system/lib/egl/libGLESv1_CM_adreno200.so 
08-17 12:37:15.014: D/libEGL(16676): loaded /system/lib/egl/libGLESv2_adreno200.so 
08-17 12:37:15.084: D/OpenGLRenderer(16676): Enabling debug mode 0 
08-17 12:37:28.584: D/dalvikvm(16676): GC_CONCURRENT freed 270K, 4% free 9003K/9351K, paused 9ms+8ms 
08-17 12:37:33.124: W/Web Console(16676): The page at https://kee.mahindrasatyam.com/_layouts/mobile/mobilesearch.aspx displayed insecure content from file:///android_asset/webkit/android-weberror.png. 
08-17 12:37:33.124: W/Web Console(16676): at null:1 
08-17 12:38:59.484: D/OpenGLRenderer(16676): Flushing caches (mode 1) 
08-17 12:39:00.354: D/OpenGLRenderer(16676): Flushing caches (mode 0) 
08-17 12:40:48.764: D/OpenGLRenderer(16676): Flushing caches (mode 1) 
08-17 12:40:48.854: D/OpenGLRenderer(16676): Flushing caches (mode 0) 
08-17 12:40:49.504: W/IInputConnectionWrapper(16676): showStatusIcon on inactive InputConnection 

回答

0

Mixed content warning檢索ID /密碼。 Chromium發出警告,因爲內容沒有像aspx頁面一樣加載https。 Chromium不喜歡您在使用https訪問的頁面上加載混合內容的事實。這是安全警告,因爲它可能會破壞頁面的安全性。您的圖片是否顯示或被阻止?看到類似的問題SSL: Why does Chrome report mixed content? (Drupal 6)。這個問題特別提到鉻也是基於鉻的。