我用以下方式打开了index.html页面,在index.html页面里点击列表打开其它页面时后台没报错要打开的页面也没显示。
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
Intent intent = null;
intent = new Intent(MainActivity.this, SDK_WebView.class);
this.startActivity(intent);
}
..............................
.............................
public class SDK_WebView extends Activity{
boolean doHardAcc = true;
EntryProxy mEntryProxy = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
if(mEntryProxy == null){
FrameLayout rootView = new FrameLayout(this);
WebviewMode wm = new WebviewMode(this,rootView);
mEntryProxy = EntryProxy.init(this,wm);
mEntryProxy.onCreate(savedInstanceState,SDK.IntegratedMode.WEBVIEW,null);
setContentView(rootView);
}
}
...........................
...........................
...........................
class WebviewMode implements ICoreStatusListener{
LinearLayout btns = null;
Activity activity = null;
ViewGroup mRootView = null;
public WebviewMode(Activity activity,ViewGroup rootView){
this.activity = activity;
mRootView = rootView;
btns = new LinearLayout(activity);
mRootView.setBackgroundColor(0xffffffff);
mRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout(){
webview.onRootViewGlobalLayout(mRootView);
}
});
}
@SuppressWarnings("deprecation")
@Override
public void onCoreInitEnd(ICore coreHandler) {
// SDK.initSDK(coreHandler);
//注册扩展的Feature
//1,featureName 为特征名称
//2, className 为处理扩展Feature的接收类全名称
//3, content 为扩展Feature而创建的js代码,代码中必须使用 plus.bridge.execSync(featureName,actionName,[arguments])或plus.bridge.exec(featureName,actionName,[arguments])与native层进行数据交互
SDK.registerJsApi(featureName, className, content);
//创建默认webapp,赋值appid
String url = "file:///android_asset/apps/HelloH5/www/index.html";
showWebview("test1", url, new FrameLayout.LayoutParams(-1,800,0));
//SDK.closeWebView(webview);
}
.................
.................
.................
后台显示内容如下:
05-27 15:41:59.129: D/adawebview(7360): webviewimp=<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>;exec evalJS=typeof mui!=='undefined'&&mui.receive('updateHeader','{"title":"右侧带数字角标","showMenu":false}')
05-27 15:41:59.139: D/webview(7360): reload loadUrl url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html
05-27 15:41:59.139: D/View_Visible_Path(7360): AdaFrameView.setVisible pVisibletrue <UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>
05-27 15:41:59.149: D/Map_Path(7360): sortNWindowByZIndex beign
05-27 15:41:59.159: D/Animation_Path(7360): showWindow<UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>
05-27 15:41:59.169: D/Animation_Path(7360): onWillDoAnimation <UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>
05-27 15:41:59.169: D/DCloud_LOG(7360): AdaFrameView.dispatchFrameViewEvents type=show_animation_end;args=null
05-27 15:41:59.169: D/DCloud_LOG(7360): execCallback pEventType=show;
05-27 15:41:59.169: D/Animation_Path(7360): onDoneAnimation <UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>
05-27 15:41:59.169: D/Animation_Path(7360): on_Done_Animation 动画完后存在窗口出栈;<UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>
05-27 15:41:59.179: D/Animation_Path(7360): removeFrameViewFromViewStack DoAnimation Frame=<UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>;Will PopFrames=[<UUID=1094145456>;<url=file:///android_asset/apps/HelloH5/www/index.html>;<hashcode=1094162616>, <UUID=NWindow51432709354807>;<url=file:///android_asset/apps/HelloH5/www/index-menu.html>;<hashcode=1093482568>]
05-27 15:41:59.179: D/Animation_Path(7360): onShowAnimationEnd;<UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>
05-27 15:41:59.179: D/View_Visible_Path(7360): show <UUID=NWindow31432709356538>;<url=file:///android_asset/apps/HelloH5/www/examples/template.html>;<hashcode=1094348600>;webview_name=default-main
05-27 15:41:59.199: D/webview(7360): onPageStarted url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html
05-27 15:41:59.199: D/DCloud_LOG(7360): AdaFrameView.dispatchFrameViewEvents type=loading;args=<UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>
05-27 15:41:59.199: D/DCloud_LOG(7360): execCallback pEventType=loading;
05-27 15:41:59.249: I/webview(7360): onReceivedTitle title=Hello MUI
05-27 15:41:59.409: I/webview(7360): onPageFinished url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html
05-27 15:41:59.409: I/webview(7360): onPageFinished loadAllJSContent url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html
05-27 15:41:59.439: D/DCloud_LOG(7360): AdaFrameView.dispatchFrameViewEvents type=loaded;args=<UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>
05-27 15:41:59.439: D/Main_Path(7360): EVENTS_LOADED mUrl=
05-27 15:41:59.439: D/DCloud_LOG(7360): execCallback pEventType=loaded;
05-27 15:41:59.449: D/ReceiveJSValue(7360): jscallnative js=["number",1]
05-27 15:41:59.459: D/webview(7360): completeLoadJs tag=onPageFinished url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html
05-27 15:41:59.469: D/ReceiveJSValue(7360): jscallnative js=["number",1]
05-27 15:41:59.479: D/dalvikvm(7360): GC_CONCURRENT freed 843K, 20% free 9548K/11911K, paused 1ms+3ms
05-27 15:41:59.479: D/webview(7360): completeLoadJs tag=onPageFinished url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html
05-27 15:41:59.719: D/View_Visible_Path(7360): AdaFrameView.setVisible pVisibletrue <UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>
05-27 15:41:59.729: D/Map_Path(7360): sortNWindowByZIndex beign
05-27 15:41:59.729: D/Animation_Path(7360): showWindow<UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>
05-27 15:41:59.729: D/Animation_Path(7360): onWillDoAnimation <UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>
05-27 15:41:59.729: D/DCloud_LOG(7360): AdaFrameView.dispatchFrameViewEvents type=show_animation_end;args=null
05-27 15:41:59.729: D/DCloud_LOG(7360): execCallback pEventType=show;
05-27 15:41:59.739: D/Animation_Path(7360): onDoneAnimation <UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>
05-27 15:41:59.739: D/Animation_Path(7360): onShowAnimationEnd;<UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>
05-27 15:41:59.739: D/View_Visible_Path(7360): show <UUID=NWindow51432709356547>;<url=file:///android_asset/apps/HelloH5/www/examples/tableviews-with-badges.html>;<hashcode=1092231632>;webview_name=default-sub
2 个回复
aaaaaaaa (作者)
index.html代码
aaaaaaaa (作者)
发现启动时控制台打印:
我项目里没有叫test1这个名字的啊
05-27 16:08:56.389: E/nwindowmgr(13504): pActionName=execMethod;pJsArgs=["NWindow","NWindow",["NWindow51432714136202",["index-menu.html",{"scalable":false,"bounce":"","left":0,"width":"70%","zindex":-1,"name":"index-menu"},"plus61432714136202","file:///android_asset/apps/HelloH5/www/index.html",{"preload":true}]]]
05-27 16:08:56.399: W/System.err(13504): java.lang.NullPointerException
05-27 16:08:56.409: W/System.err(13504): at io.dcloud.feature.ui.e.a(UIWidgetMgr.java:398)
05-27 16:08:56.409: W/System.err(13504): at io.dcloud.feature.ui.UIFeatureImpl.execute(UIFeatureImpl.java:23)