我收到主题行中提到的错误,同时使用共享优先级排除webview。我也发布了代码和logcat。请告知我可能出错的地方?我基本上试图在webview中打开https网站并使用共享首选项
检索id / pwd 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 :(得分:0)
Mixed content warning。 Chromium警告,因为内容未加载https,如aspx页面。 Chromium不喜欢您在使用https访问的页面上加载混合内容的事实。它是安全警告,因为它可能破坏页面的安全性。您的图片是否未显示或被屏蔽?看到这个类似的问题SSL: Why does Chrome report mixed content? (Drupal 6)。这个问题明确提到Chrome也是以铬为基础的。