Ejemplo n.º 1
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);
    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

    tv_brand = (TextView) view.findViewById(R.id.tv_brand);
    tv_xilie = (TextView) view.findViewById(R.id.tv_xilie);
    tv_pro = (TextView) view.findViewById(R.id.tv_pro);
    tv_area = (TextView) view.findViewById(R.id.tv_area);
    et_no = (EditText) view.findViewById(R.id.et_no);
    btn_save = (Button) view.findViewById(R.id.btn_save);
    btn_delete = (Button) view.findViewById(R.id.btn_delete);
    //		ll_5 = (LinearLayout) view.findViewById(R.id.ll_5);
    OnClick onClick = new OnClick();
    tv_brand.setOnClickListener(onClick);
    tv_xilie.setOnClickListener(onClick);
    tv_pro.setOnClickListener(onClick);
    tv_area.setOnClickListener(onClick);
    et_no.setOnClickListener(onClick);
    btn_save.setOnClickListener(onClick);
    btn_delete.setOnClickListener(onClick);

    if ("add".equals(getActivity().getIntent().getStringExtra("option"))) {
      mDetailTitlebar.setTitle("添加车辆");
    } else {
      mDetailTitlebar.setTitle("车辆信息");
      try {
        jsonCar = new JSONObject(getActivity().getIntent().getStringExtra("car"));
        System.out.println("jsoncar:" + jsonCar);
      } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      setInfo();
    }
  }
Ejemplo n.º 2
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   // TODO Auto-generated method stub
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == 0 && data != null && data.getStringExtra("brand") != null) {
     try {
       JSONObject jsonBrand = new JSONObject(data.getStringExtra("brand"));
       tv_brand.setText(jsonBrand.getString("carcategoryname"));
       brandID = jsonBrand.getString("carcategoryid");
       //				System.out.println(jsonBrand.toString());
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   } else if (requestCode == 1 && data != null && data.getStringExtra("xilie") != null) {
     try {
       JSONObject jsonXilie = new JSONObject(data.getStringExtra("xilie"));
       tv_xilie.setText(jsonXilie.getString("carseriesidname"));
       xilieID = jsonXilie.getString("carseriesidid");
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   } else if (requestCode == 2 && data != null && data.getStringExtra("pro") != null) {
     try {
       JSONObject jsonPro = new JSONObject(data.getStringExtra("pro"));
       tv_pro.setText(jsonPro.getString("provincename"));
       proID = jsonPro.getString("provinceid");
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   } else if (requestCode == 3 && data != null && data.getStringExtra("area") != null) {
     tv_area.setText(data.getStringExtra("area"));
   }
 }