1.SDK去腾讯sdk官网下载:
下面是主要实现的code:
加载内核(入口):
package org.fdcch.record.view.activity;
import android.app.Application;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.tencent.smtt.sdk.QbSdk;
import org.fdcch.record.dao.DaoMaster;
import org.fdcch.record.dao.DaoSession;
public class MyApplication extends Application {
private static DaoSession mDaoSession;
private String token;
private String userName,password;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
@Override
public void onCreate() {
super.onCreate();
isUp();
createDao();
startActivity(new Intent(this, LaunchActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
public static DaoSession getmDaoSession() {
return mDaoSession;
}
private void createDao(){
DaoMaster.DevOpenHelper devOpenHelper=new DaoMaster.DevOpenHelper(getBaseContext(),"dngl.db",null);
SQLiteDatabase sqLiteDatabase=devOpenHelper.getWritableDatabase();
DaoMaster daoMaster=new DaoMaster(sqLiteDatabase);
mDaoSession=daoMaster.newSession();
}
private void isUp(){
QbSdk.initX5Environment(getBaseContext(), new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
}
@Override
public void onViewInitFinished(boolean b) {
if (b){
Log.e("aaa","加载内核成功");
}else {
Log.e("aaa","加载内核失败");
}
}
});
}
}
布局xml文件:
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="recordDetailShow"
type="org.fdcch.record.viewmodel.activity.RecordDetailShowViewModel">
</variable>
</data>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".view.activity.RecordDetailActivity">
<LinearLayout
android:id="@+id/ll_header"
android:orientation="horizontal"
android:background="@color/white"
android:padding="@dimen/qb_px_15"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_record_detail_show_back"
android:layout_centerVertical="true"
android:src="@drawable/ic_action_back"
android:layout_alignParentLeft="true"
android:layout_width="@dimen/qb_px_22"
android:layout_height="@