Intent传值

//点击
@Override
public void success(FLXQ_Bean flxq_bean) {
    final List<FLXQ_Bean.DataBean> data = flxq_bean.getData();
    FENLEIXQAdapter fenleixqAdapter=new FENLEIXQAdapter(this,data);

    fenleixqAdapter.setFenleixqClick(new FENLEIXQAdapter.FENLEIXQClick() {
        @Override
        public void onFLXQClick(int position) {

            int itemtype = data.get(position).getItemtype();
            Intent intent=new Intent(FenLXQActivity.this,ShangpinXQActivity.class);
            intent.putExtra("itemtype",itemtype+"");
            startActivity(intent);
        }
    });
    fenllei_xq_rlv.setAdapter(fenleixqAdapter);
}
 
//跳转
public class ShangpinXQActivity extends AppCompatActivity {

    private ImageView iv;
    private TextView titel;
    private TextView neirong;
    private TextView yuanjia;
    private TextView xianjia;
    private String typeNum;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shangpin_xq);

        iv = (ImageView) findViewById(R.id.xq_imageView1);
        titel = (TextView) findViewById(R.id.xq_titel1);
        neirong = (TextView) findViewById(R.id.xq_xiangqing1);
        yuanjia = (TextView) findViewById(R.id.xq_yuanjia1);
        xianjia = (TextView) findViewById(R.id.xq_xianjia1);
        yuanjia.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG);


        Map<String, String> map = new HashMap<>();
        Intent intent = getIntent();
         typeNum = intent.getStringExtra("itemtype");
        map.put("pscid","2");
        OkHttp3Utils.doPost(API.FENLEIXQ, map, new GsonObjectCallback<ShangPingXQ_Bean>() {
            @Override
            public void onUi(ShangPingXQ_Bean shangPingXQ_bean) {
                if (typeNum.equals("2")){
                    String[] split = shangPingXQ_bean.getData().get(0).getImages().split("\\|");

                    Glide.with(ShangpinXQActivity.this).load(split[0]).into(iv);
                    titel.setText(shangPingXQ_bean.getData().get(0).getTitle());
                    neirong.setText(shangPingXQ_bean.getData().get(0).getSubhead());
                    yuanjia.setText(shangPingXQ_bean.getData().get(0).getPrice() + "");
                    xianjia.setText(shangPingXQ_bean.getData().get(0).getBargainPrice()+ "");
                }
                if (typeNum.equals("1")){
                    String[] split = shangPingXQ_bean.getData().get(2).getImages().split("\\|");

                    Glide.with(ShangpinXQActivity.this).load(split[0]).into(iv);
                    titel.setText(shangPingXQ_bean.getData().get(2).getTitle());
                    neirong.setText(shangPingXQ_bean.getData().get(2).getSubhead());
                    yuanjia.setText(shangPingXQ_bean.getData().get(2).getPrice() + "");
                    xianjia.setText(shangPingXQ_bean.getData().get(2).getBargainPrice()+ "");
                }
                if (typeNum.equals("0")){
                    String[] split = shangPingXQ_bean.getData().get(1).getImages().split("\\|");

                    Glide.with(ShangpinXQActivity.this).load(split[0]).into(iv);
                    titel.setText(shangPingXQ_bean.getData().get(1).getTitle());
                    neirong.setText(shangPingXQ_bean.getData().get(1).getSubhead());
                    yuanjia.setText(shangPingXQ_bean.getData().get(1).getPrice() + "");
                    xianjia.setText(shangPingXQ_bean.getData().get(1).getBargainPrice()+ "");
                }
            }
            @Override
            public void onFailed(Call call, IOException e) {
            }
        });


    }

    }

 

                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值