仿京东的购物车和订单

//从购物车跳转到了确认订单界面

/**

* 确认下单界面
*/
public class Main2Activity extends AppCompatActivity {
private TextView text_order;
private TextView text_kuan;
private ImageView tu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);

Intent intent = getIntent();

final CountPriceBean countPriceBean = (CountPriceBean) intent.getSerializableExtra("order");

text_kuan = (TextView) findViewById(R.id.text_kuan);
text_order = (TextView) findViewById(R.id.text_order);
tu = (ImageView) findViewById(R.id.maidongxidetupian);

text_kuan.setText("实付款: ¥"+countPriceBean.getPrice());

text_order.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

OkHttp3Util.doGet("https://www.zhaoapi.cn/product/createOrder?uid=2845&price=" + countPriceBean.getPrice(), new Callback() {
@Override
public void onFailure(Call call, IOException e) {

}

@Override
public void onResponse(Call call, Response response) throws IOException {
final String string = response.body().string();

CommonUtils.runOnUIThread(new Runnable() {
@Override
public void run() {
Toast.makeText(Main2Activity.this, string,Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Main2Activity.this, Main3Activity.class);

// intent.putExtra("toux",chachebean.getData().get(0).getList().g)
// intent.putExtra("order",countPriceBean);

startActivity(intent);
}
});
}
});
}
});



}

public void huiqu2(View view) {
AlertDialog.Builder ab=new AlertDialog.Builder(Main2Activity.this);
ab.setTitle("你在三思三思~~~~");

ab.setPositiveButton("去意已决", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
});
ab.setNegativeButton("再看看",null);
ab.show();

}

public void dingdanzhongxin(View view) {
Intent intent = new Intent(Main2Activity.this, Main3Activity.class);
startActivity(intent);
}

}

//布局示例

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Main2Activity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:orientation="horizontal"
        android:layout_alignParentTop="true"
        android:id="@+id/ding"
        >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text=""
            android
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值