当前位置:网站首页>Json数据的格式使用
Json数据的格式使用
2022-07-27 14:48:00 【白马镇的少年】
public SearchOrderBean typeBean;//SearchOrderBean 实体类里面是后台返回的数据类型和参数typeBean可在其他地方访问
public void serchOrder() {
ActivateDevice mo = ShareInfo.getObject(ActivateDevice.class);
//参数
Map<String, String> map = new HashMap<>();
map.put(Constans.MERCHANTID, mo.getMerchantId());
map.put(Constans.STOREID, mo.getStoreId());
map.put(Constans.DEVICEID, mo.getDeviceId());
map.put(Constans.PAGE, page + "")
//访问接口
SSClient.getInstance().doRequest01(BaseParams.getBaseAddressUrl02(PosInterface.PAY_ORDER_LIST), map, new SSLCallBack() {
@Override
public void onFailed(Call call, IOException e) {
//失败哦
}
@Override
public void onReponse(Call call, String response) {
//解析数据
JSONObject jsonObject = JSON.parseObject(response);
String proInfo = jsonObject.getString("data");//data数据里面的字段
String tips = jsonObject.getString("tips");//tips 数据里面的字段
typeBean = JSON.parseObject(response, SearchOrderBean.class);
子线程里请求数据加载
((Activity) binding.getRoot().getContext()).runOnUiThread(new Runnable()
{
@Override
public void run() {
binding.recyclerView.setAdapter(mAdapter = new OneAddpter(binding.getRoot().getContext(),listdat ));
binding.recyclerView.setLayoutManager(new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL));
mAdapter.notifyDataSetChanged();//刷新改变的数据
//设置item的点击事件
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClickListener(View view, int position) {
Log.e("TAG", "您点击了item的点击事件");
Intent intent = new
Intent(binding.getRoot().getContext(),
OrderDetailActivity.class);
intent.putExtra("tradeNo",
typeBean.getData().getSmtransactionConditions().get(position).getTradeNo());
binding.getRoot().getContext().startActivity(intent);
}
});
}
});
}
});
}
边栏推荐
- 201403-1
- t5 学习
- Coding skills - Global exception capture & unified return body & Business exception
- The method of inserting degree in word
- The first week of C language learning - the history of C language
- Time series ARIMA model
- Mazak handwheel maintenance Mazak little giant CNC machine tool handle operator maintenance av-eahs-382-1
- The class declared by the scala object keyword directly calls methods and associated objects
- OpenCV(五)——运动目标识别
- 闲聊技巧
猜你喜欢

Jupyter creates a virtual environment and installs pytorch (GPU)

字节跳动服务网格基于 Hertz 框架的落地实践

Replication of complex linked list

MySQL high version report SQL_ mode=only_ full_ group_ By exception

Exe program encryption lock

OpenCV(四)——图像特征与目标检测

DRF learning notes (IV): DRF view

DEX and AMMS of DFI security

Notes on implementation and acquisition of flowable custom attributes

雪花ID(Go 实现)
随机推荐
my_ls小结
Handling of multiple parts with duplicate names and missing parts when importing SOLIDWORK assemblies into Adams
MySQL index
matlab legend用法
Cubemx combined with IAR engineering transplantation
Test novice learning classic (with ideas)
The solution to the memory exhaustion problem when PHP circulates a large amount of data
C语言逆序输出字符串
TP5 query empty two cases
HowNet and Wanfang database download papers for free ----- several times faster than connecting to the school intranet (some schools Wanfang database does not support downloading)
Common Oracle statements
DRF learning notes (II): Data deserialization
Pointer summary
嵌入式面试
C language output string in reverse order
OpenCV(四)——图像特征与目标检测
Unable to enter the function definition after transferring the IAR project folder to the directory
大数相加
Use of arrow function
Log management