1.调用.so文件错误:unsatisfy error Link,
解决方案:要么libs目录下只有arneabi或armeabi-va7,要么两者都有,否则报上述错误。
2.webview相关错误:
1》.webview加载HTML5中的视频点击全屏的时候会报错的Bug。
解决方案:
package com.kbmc.tikids.bbt.activity;
import com.kbmc.tikids.unicom.R;
import com.kbmc.tikids.bbt.expertquestion.act.Expertmain;
import com.kbmc.tikids.bbt.utils.CacheManagerApp;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.webkit.ConsoleMessage;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebChromeClient.CustomViewCallback;
import android.webkit.WebSettings.PluginState;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class BrandActivity extends AppAbstractActivity {
TextView title_name;
WebView webview;
private View myView = null;
private CustomViewCallback myCallback = null;
private WebChromeClient chromeClient = null;
@Override
public void ensureUI(Bundle arg0) {
setContentView(R.layout.find_sub);
webview = (WebView) findViewById(R.id.webview);
title_name = (TextView) findViewById(R.id.title_name);
WebSettings wSet = webview.getSettings();
wSet.setJavaScriptEnabled(true);
// wSet.setPluginsEnabled(true);
wSet.setPluginState(PluginState.ON);// altered by kaiqiangzhang
wSet.setJavaScriptCanOpenWindowsAutomatically(true);
title_name.setText(getString(R.string.find_one));
webview.loadUrl(CacheManagerApp.PINPAI_URL);
// 濡傛灉椤甸潰涓摼鎺ワ紝濡傛灉甯屾湜鐐瑰嚮閾炬帴缁х画鍦ㄥ綋鍓峛rowser涓搷搴旓紝
// 鑰屼笉鏄柊寮€Android鐨勭郴缁焍rowser涓搷搴旇閾炬帴锛屽繀椤昏鐩杦ebview鐨刉ebViewClient瀵硅薄
webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) { // 閲嶅啓姝ゆ柟娉曡〃鏄庣偣鍑荤綉椤甸噷闈㈢殑閾炬帴杩樻槸鍦ㄥ綋鍓嶇殑webview閲岃烦杞紝涓嶈烦鍒版祻瑙堝櫒閭h竟
view.loadUrl(url);
return true;
}
});
chromeClient=new MyChromeClient();
webview.setWebChromeClient(chromeClient);
// // 鐐瑰嚮鍚庨€€鎸夐挳,璁¦ebView鍚庨€€涓€椤?涔熷彲浠ヨ鍐橝ctivity鐨刼nKeyDown鏂规硶)
// webview.setOnKeyListener(new View.OnKeyListener() {
// @Override
// public boolean onKey(View v, int keyCode, KeyEvent event) {
// if (event.getAction() == KeyEvent.ACTION_DOWN) {
// if (keyCode == KeyEvent.KEYCODE_BACK && webview.canGoBack()) {
// //琛ㄧず鎸夎繑鍥為敭 鏃剁殑鎿嶄綔
// webview.goBack(); //鍚庨€€
//
// //webview.goForward();//鍓嶈繘
// return true; //宸插鐞? // }
// }
// return false;
// }
// });
if(arg0 != null){
webview.restoreState(arg0);
}
}
@Override
public void fillData() {
}
@Override
public void loadData(Intent arg0) {
}
@Override
protected void onPause() {
if(chromeClient!=null)
chromeClient.onHideCustomView();
webview.onPause();
super.onPause();
}
@Override
protected void onResume() {
webview.onResume();
super.onResume();
}
@Override
public void refreshUI() {
}
@Override
public void refreshUI(Object arg0) {
}
protected void onDestroy() {
super.onDestroy();
webview.removeAllViews();
webview.destroy();
}
public class MyChromeClient extends WebChromeClient{
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (myCallback != null) {
myCallback.onCustomViewHidden();
myCallback = null;
return;
}
long id = Thread.currentThread().getId();
Log.v("WidgetChromeClient", "rong debug in showCustomView Ex: "
+ id);
ViewGroup parent = (ViewGroup) webview.getParent();
String s = parent.getClass().getName();
Log.v("WidgetChromeClient", "rong debug Ex: " + s);
parent.removeView(webview);
parent.setBackgroundColor(getResources().getColor(R.color.Black));
view.setLayoutParams(new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
parent.addView(view);
myView = view;
myCallback = callback;
chromeClient=this;
}
@Override
public void onHideCustomView() {
long id = Thread.currentThread().getId();
Log.v("WidgetChromeClient", "rong debug in hideCustom Ex: "
+ id);
if (myView != null) {
if (myCallback != null) {
myCallback.onCustomViewHidden();
myCallback = null;
}
ViewGroup parent = (ViewGroup) myView.getParent();
parent.removeView(myView);
parent.addView(webview);
myView = null;
}
}
}
@Override
protected void onStop() {
super.onStop();
}
@Override
public void onBackPressed() {
if(myView == null){
super.onBackPressed();
}
else{
chromeClient.onHideCustomView();
}
}
}
2).webview获取URL和标题的方法
解决方案: