package com.example.zjj1603b20180910.constant;
public class constant {
//定义接口地址
public static final String URL="https://app.tuozhe8.com/api.php/api/Lists/content_lists&version=1.7&token=&type=1&cat=&catid2=&page=1";
public static final String BASE_URL="https://app.tuozhe8.com/api.php/api/Lists/";
}
//api
package com.example.zjj1603b20180910.api;
import com.example.zjj1603b20180910.bean.news;
import io.reactivex.Observable;
import retrofit2.http.GET;
public interface api {
@GET("content_lists&version=1.7&token=&type=1&cat=&catid2=&page=1")
Observable<news> getresponse();
}
//app类
package com.example.zjj1603b20180910.app;
import android.app.Application;
import android.database.sqlite.SQLiteDatabase;
import com.example.zjj1603b20180910.bean.DaoMaster;
import com.example.zjj1603b20180910.bean.DaoSession;
import com.facebook.drawee.backends.pipeline.Fresco;
public class app extends Application {
private static app app;
private DaoSession daoSession;
@Override
public void onCreate() {
super.onCreate();
//上下文
app=app.this;
//初始化
Fresco.initialize(this);
//获取具体事务
DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "bwie");
//获取可读可写数据库
SQLiteDatabase db = helper.getWritableDatabase();
//配置默认信息
DaoMaster daoMaster = new DaoMaster(db);
//做曾删改查
daoSession = daoMaster.newSession();
}
public static app getinstance(){
if (app==null){
app=new app();
}
return app;
}
//提供方法
public DaoSession getDaoSession() {
return daoSession;
}
}