Crosswalk web引擎Android中的使用
2016-03-28 18:07
92 查看
Crosswalk 入门
http://www.mobibrw.com/p=1934
Crosswalk XWalkCookieManager 介绍
http://code.taobao.org/p/crosswalk_browser/diff/3/trunk/XWalkEmbed/src/com/huosu/qingapp
布局界面 activity_web_show1.xml
http://www.mobibrw.com/p=1934
Crosswalk XWalkCookieManager 介绍
http://code.taobao.org/p/crosswalk_browser/diff/3/trunk/XWalkEmbed/src/com/huosu/qingapp
package com.test; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.RelativeLayout; import android.widget.TextView; import com.tool.http.HttpSend; import com.tool.http.WebUrl; import org.xwalk.core.XWalkCookieManager; import org.xwalk.core.XWalkView; public class WebShowActivity extends Activity { private String url; private XWalkView mXWalkView; @SuppressLint("JavascriptInterface") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_web_show1); url = WebUrl.getUrl() + "platform/" + bundle.getString("url")+"?pageId="+bundle.getString("pageid"); mXWalkView = (XWalkView) findViewById(R.id.webView); XWalkCookieManager xWalkCookieManager=new XWalkCookieManager(); xWalkCookieManager.setCookie(url, HttpSend.SET_COOKIE);//在此注入cookieId,保持连接 mXWalkView.load(url, null); RelativeLayout goback = (RelativeLayout) findViewById(R.id.gobackRelativeLayout); goback.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } @Override protected void onPause() { super.onPause(); if (mXWalkView != null) { mXWalkView.pauseTimers(); mXWalkView.onHide(); } } @Override protected void onResume() { super.onResume(); if (mXWalkView != null) { mXWalkView.resumeTimers(); mXWalkView.onShow(); } } @Override protected void onDestroy() { super.onDestroy(); if (mXWalkView != null) { mXWalkView.onDestroy(); } } @Override protected void onActivityResult(int requestCode, int resultCode,Intent data) { if (mXWalkView != null) { mXWalkView.onActivityResult(requestCode, resultCode, data); } } @Override protected void onNewIntent(Intent intent) { if (mXWalkView != null) { mXWalkView.onNewIntent(intent); } } }
布局界面 activity_web_show1.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.leanweb.WebShowActivity"> <org.xwalk.core.XWalkView android:id="@+id/webView" android:layout_width="wrap_content" android:layout_height="wrap_content"> </org.xwalk.core.XWalkView> </LinearLayout>
相关文章推荐
- Android Intent的作用,哪些类型的数据可以被传递
- android studio 使用checkstyle全攻略
- Android常见分辨率(mdpi、hdpi 、xhdpi、xxhdpi )尺寸单位转换和屏幕适配相关
- Java基础知识JNI 在Android中使用System.loadLibrary()
- android系统中创建数据库,并创建表
- Android 高德地图点击地图获取经纬度
- Android AIDL简要介绍及使用
- Android:如何给ScrollView添加滑块滚动条
- Android高效加载大图、多图解决方案,有效避免程序OOM
- Activity的四种启动模式--看Android开发艺术探索总结
- android数据加密(二)AES加密
- android 根据时间是否过期进行文件的删除
- 深入分析Android native exception框架
- Android 三大图片缓存原理、特性对比
- android右滑返回上一个界面
- Android优化Adapter内的Click、LongClick
- Android Interface Definition Language (AIDL)
- Android最佳性能实践(一)——合理管理内存
- Android实践之Drawable的使用
- Android判断软键盘显示状态并隐藏