public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private RecyclerView mRecyclerView;
private Button mBtn;
private List<Goods.DataBean> mList;
private ArrayList<Goods.DataBean> mDataList = new ArrayList<>();
private MyRecyclerAdapter mAdapter;
private String mUrl = "http://m.yunifang.com/yunifang/mobile/goods/getall?random=39986&encode=2092d7eb33e8ea0a7a2113f2d9886c90&category_id=17";
private String mData;
private Handler mHandler=new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
initData();
}
private void initData() {
new Thread(new Runnable() {
@Override
public void run() {
mData = OkHttpManager.getSyncString(mUrl);
Goods goods = GsonUtil.getBean(mData, Goods.class);