public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RetrofitHelper.getShopApi().home(Constants.TOKEN,"71e58b5b2f930eaf1f937407acde08fe","10")
.subscribeOn(Schedulers.io())//被观察者执行线程
.observeOn(AndroidSchedulers.mainThread())//观察者线程
.subscribe(new Consumer<UserBean>() {
@Override
public void accept(UserBean userBean) throws Exception {
List<UserBean.NewslistBean> newslist = userBean.getNewslist();
Toast.makeText(MainActivity.this,newslist.get(1).getCtime(),Toast.LENGTH_LONG).show();
}
});
}
}