//从购物车跳转到了确认订单界面
/**
* 确认下单界面*/
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