RxJava + Retrofit
一、添加依赖
compile 'io.reactivex:rxandroid:1.2.0'
compile 'io.reactivex:rxjava:1.1.5'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:converter-jackson:2.0.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.squareup.okio:okio:1.6.0'
二、添加依赖可能出现的错误以及解决
Error:Execution failed for task':retrofitdemo:transformResourcesWithMergeJava
解决方法:
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
}
三、操作:
(1)延时操作
private void timerOption() {
Observable.timer(3000, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Long>() {
@Override
public void call(Long aLong) {
startActivity(new Intent(SplashActivity.this, NewsActivity.class));
overridePendingTransition(0, android.R.anim.fade_out);
finish();
}
});
}
(2)具体使用:
RxJava + Retrofit的更多相关文章
- RxJava + Retrofit 的实际应用场景
关于 RxJava Retrofit 很多篇文章都有详细的说明,在这里我想分享一个具体的使用案例,在我的开源项目 就看天气 里的实际应用.也希望跟大家探讨如何优雅的使用. 准备 项目中用到的依赖: c ...
- 手把手带你走进MVP +Dagger2 + DataBinding+ Rxjava+Retrofit 的世界
0.0 Android开发现在的变化用一个词来形容就是 :翻天覆地 越来越多的项目使用了MVP + Rxjava+Retrofit +Dagger2 + DataBinding等等东西.. 但是这些东 ...
- Rxjava + retrofit + dagger2 + mvp搭建Android框架
最近出去面试,总会被问到我们项目现在采用的什么开发框架,不过据我的经验网络框架(volley)+图片缓存(uIl)+数据库(orm)+mvp,不过现在这套框架比较好了,现在采用什么呢?Rxjava + ...
- RxJava+Retrofit+OkHttp,一步一步封装网络框架;
使用RxJava+Retrofit+OkHttp,首先在build.gradle添加: compile 'com.squareup.okhttp3:okhttp:3.8.1' compile 'com ...
- RxJava + Retrofit完成网络请求
1.前言 本文基于RxJava.Retrofit的使用,若是对RxJava或Retrofit还不了解的简友可以先了解RxJava.Retrofit的用法再来看这篇文章. 在这片文章之前分别单独介绍过R ...
- Android RxJava+Retrofit完美封装
作者简介 本篇来自 小河马 的投稿,分享了自己是如何进行 RxJava+Retrofit 的封装.本文的技术点自然没话说,另外对于这种模块化的思路,希望能帮助到大家.最后提前祝大家周末愉快以及圣诞快乐 ...
- 开发 Material Design+RxJava+Retrofit+MVP App 参考资料
前言 在开发一个基于 Material Design+RxJava+Retrofit+MVP 框架的 App 过程中学习的资料整理 —— 由G军仔分享 这里记录了我开发 大象 项目时,所学习的 ...
- Rxjava+retrofit+mvp整合
转载请标明出处: http://blog.csdn.net/forezp/article/details/52621898 本文出自方志朋的博客 最近在看Rxjava,写了一个简单的 demo整合了R ...
- RxJava+Retrofit实现网络请求
RxJava+Retrofit实现网络请求: 首先要添加依赖 compile 'io.reactivex:rxjava:x.y.z' compile 'io.reactivex:rxandroid:1 ...
- android打飞机游戏、MVP句子迷App、悬浮窗、RxJava+Retrofit、加载动画、定制计划App等源码
Android精选源码 微信打飞机 android进度设置加载效果源码 Android新手引导库EasyGuide MVP-好看又好用的句子迷客户端 XFloatView 一个简易的悬浮窗实现方案 a ...
随机推荐
- shell 冒号
: ${TEST_LOOP:='1'} 如果不在前面加上:(冒号)命令,那么就会把${TEST_LOOP:='1'}本身当做一个命令来执行,报错是肯定的. [root@node56 ~]# : abc ...
- USB设备被识别流程
源: USB设备被识别流程
- django模型的crud操作
一个建立好的模型,django会生成一套完整的API,以便对对象进行crud操作,下面就详细介绍crud操作. 先说一下操作环境: python2.7, django1.11.8, win7系统,借助 ...
- Centos 7系统虚拟机桥接模式 固定ip
前言 本文主要给大家介绍了关于Centos 7系统虚拟机桥接模式的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧. 主机ping不通虚拟机centos7系统的ip大多有以下原 ...
- python简说(十一)os模块
import osres = os.listdir('/Users/nhy/Desktop') #列出某个目录下的所有文件# os.remove()# os.rename()# os.mkdir(r' ...
- Testng测试报告
执行完测试用例之后,会在项目的test-output(默认目录)下生成测试报告
- Python3基础 response.info 服务器返回的header信息
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- 抠图|计蒜客2019蓝桥杯省赛 B 组模拟赛(一)
样例输入: 3 4 5 1 0 0 0 1 1 0 1 0 1 1 0 1 0 1 1 0 0 0 1 5 6 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 0 0 ...
- 作为非计算机专业的学生,觉得 C 语言远比其他语言易于上手,正常吗?
作者:invalid s链接:https://www.zhihu.com/question/26659552/answer/615531516来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非 ...
- POJ 3041 Asteroids(最小点覆盖)题解
题意:n*n的网格中有k个点,开一枪能摧毁一行或一列的所有点,问最少开几枪 思路:我们把网格看成两个集合,行集合和列集合,如果有点x,y那么就连接x->y,所以我们只要做最小点覆盖就好了. 参考 ...