Java tutorial
package com.jiandanbaoxian.ui.buyinsurance.car_insurance; import android.app.Activity; import android.app.DatePickerDialog; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.CompoundButton; import android.widget.DatePicker; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Spinner; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.jiandanbaoxian.adapter.SpinnerDropDownAdapter; import com.jiandanbaoxian.api.callback.NetCallback; import com.jiandanbaoxian.api.user.UserRetrofitUtil; import com.jiandanbaoxian.constant.PreferenceConstant; import com.jiandanbaoxian.model.CommData; import com.jiandanbaoxian.model.CommPriceData; import com.jiandanbaoxian.model.InsuranceItemData; import com.jiandanbaoxian.model.NetWorkResultBean; import com.jiandanbaoxian.model.VehicleTypeInfo; import com.jiandanbaoxian.ui.LoginActivity; import com.jiandanbaoxian.util.PreferenceUtil; import com.jiandanbaoxian.util.ProgressDialogUtil; import com.jiandanbaoxian.widget.customswitch.SwitchButton; import android.widget.TextView; import android.widget.Toast; import com.jiandanbaoxian.R; import com.jiandanbaoxian.ui.BaseActivity; import com.jiandanbaoxian.widget.TitleBar; import java.lang.reflect.Type; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import javax.net.ssl.HttpsURLConnection; import retrofit.RetrofitError; import retrofit.client.Response; /** * Created by sooglejay on 16/2/24. */ public class CarInsurancePricePlanActivity extends BaseActivity { java.text.NumberFormat nf = java.text.NumberFormat.getInstance();//double ? private SimpleDateFormat dateFormat_yyyy_MM_dd = new SimpleDateFormat("yyyy-MM-dd");//? private Activity activity; ProgressDialogUtil progressDialogUtil; String userid = ""; String engineNumber = ""; String seatingcapacity = "0"; double newValue = 0; String model_code = ""; String ownerName = ""; long commercestartdate = 0; long compulsorystartdate = 0; private String licenseplate = ""; private String frameNumber = ""; private String registrationDateString = ""; private String issueDateString = ""; String provence = ""; String provnce_no = ""; String city_no = ""; String country_no = ""; String transfer = "1"; String transferDate = "0"; String idcardNum = ""; String phone = ""; String compulsoryAmt = "122000"; String insuranceItems = ""; String type = "0"; private List<InsuranceItemData> insuranceItemDatas = new ArrayList<>(); // InsuranceItemData motor_vehicle_loss_insurance = new InsuranceItemData(); InsuranceItemData third_responsibility_insurance = new InsuranceItemData(); InsuranceItemData cab_seat_insurance = new InsuranceItemData(); InsuranceItemData passenger_seat_insurance = new InsuranceItemData(); InsuranceItemData rob_insurance = new InsuranceItemData(); // InsuranceItemData shade_lining_insurance = new InsuranceItemData(); InsuranceItemData risk_of_spontaneous_combustion_insurance = new InsuranceItemData(); InsuranceItemData risk_of_scratches_insurance = new InsuranceItemData(); InsuranceItemData risk_of_engine_wading_insurance = new InsuranceItemData(); // private boolean flag_switch_SDEWCabSeatInsurance = true; private boolean flag_switch_SDEWMotorVehicleLossInsurance = true; private boolean flag_switch_SDEWPassengerSeatInsurance = true; private boolean flag_switch_SDEWThirdResponsibilityInsurance = true; private boolean flag_switch_SDEWRobInsurance = false; // // // private boolean flag_layout_SDEWCabSeatInsurance = false; // private boolean flag_layout_SDEWMotorVehicleLossInsurance = false; // private boolean flag_layout_SDEWPassengerSeatInsurance = false; // private boolean flag_layout_SDEWRobInsurance = false; // private boolean flag_layout_SDEWThirdResponsibilityInsurance = false; // private boolean flag_switch_SDEWShadeLiningInsurance = false;// private boolean flag_switch_SDEWRiskOfSpontaneousCombustionInsurance = false;// private boolean flag_switch_SDEWRiskOfScratchesInsurance = false;// private boolean flag_switch_SDEWRiskOfEngineWadingInsurance = false;//? // // // private boolean flag_layout_SDEWShadeLiningInsurance = false; // private boolean flag_layout_SDEWRiskOfSpontaneousCombustionInsurance = false; // private boolean flag_layout_SDEWRiskOfScratchesInsurance = false; // private boolean flag_layout_SDEWRiskOfEngineWadingInsurance = false; List<String> valuesOfScratchesInsurance = new ArrayList<>(); List<String> valuesOfThirdResponsibilityInsurance = new ArrayList<>(); List<String> valuesOfCabSeatInsurance = new ArrayList<>(); List<String> valuesOfPassengerSeatInsurance = new ArrayList<>(); private SpinnerDropDownAdapter spinnerAdapterRiskOfScratchesInsurance; private SpinnerDropDownAdapter spinnerAdapterThirdResponsibilityInsurance; private SpinnerDropDownAdapter spinnerAdapterCabSeatInsurance; private SpinnerDropDownAdapter spinnerAdapterPassengerSeatInsurance; //????? // // 3650012000.00 // 3650025000.00 // 36500310000.00 // 36500420000.00 // // 30600600450000 // 306006005100000 // 306006018150000 // 306006006200000 // 306006007300000 // 306006009500000 // 3060060141000000 // 3060060191500000 // 3060060202000000 // 3060060212500000 // 3060060223000000 // 3060060233500000 // 3060060244000000 // 3060060254500000 // 3060060265000000 // // ? // 203050100 // ?? 12510 // ? 12510 // // // // // /? // 2k5k10k20k // // // ? // // // // private LinkedHashMap<String, Double> hashRiskOfScratchesInsurance = new LinkedHashMap<>(); private LinkedHashMap<String, Double> hashThridResponsibilityInsurance = new LinkedHashMap<>(); private LinkedHashMap<String, Double> hashCabSeatInsurance = new LinkedHashMap<>(); private LinkedHashMap<String, Double> hashPassengerInsurance = new LinkedHashMap<>(); private LinkedHashMap<String, Double> hashShadelining = new LinkedHashMap<>(); List<String> valuesOfShadeLiningInsurance = new ArrayList<>(); private String glassType = "303011001"; private SpinnerDropDownAdapter spinnerAdapterShadeLiningInsurance; public static void startActivity(Activity activity, String licenseplate, String engineNumber, String model_code, float newValue, String framenumber, String ownerName, String province_no, String province_name, String city_no, String city_name, String country_no, String country_name, String transfer, String transferDate, String registerationDateString, String issueDateString, String idcardNum) { Intent intent = new Intent(activity, CarInsurancePricePlanActivity.class); intent.putExtra("licenseplate", licenseplate); intent.putExtra("engineNumber", engineNumber); intent.putExtra("frameNumber", framenumber); intent.putExtra("userName", ownerName); intent.putExtra("province_no", province_no); intent.putExtra("province_name", province_name); intent.putExtra("city_no", city_no); intent.putExtra("city_name", city_name); intent.putExtra("country_no", country_no); intent.putExtra("country_name", country_name); intent.putExtra("model_code", model_code); intent.putExtra("newValue", newValue); intent.putExtra("transfer", transfer); intent.putExtra("transferDate", transferDate); intent.putExtra("registrationDateString", registerationDateString); intent.putExtra("issueDateString", issueDateString); intent.putExtra("idcardNum", idcardNum); activity.startActivity(intent); } private LinearLayout layoutCommercialDatePicker; private TextView tvCommercialStartDate; private LinearLayout layoutCompulsoryDatePicker; private TextView tvCompulsoryStartDate; private LinearLayout layoutMotorVehicleLossInsurance; private ImageView ivSDEWMotorVehicleLossInsurance; private TextView tvSDEWMotorVehicleLossInsurance; private SwitchButton switchTabViewMotorVehicleLossInsurance; private Spinner spinnerThirdResponsibility; private LinearLayout layoutThirdResponsibility; private ImageView ivSDEWThirdResponsibilityInsurance; private TextView tvSDEWThirdResponsibilityInsurance; private SwitchButton switchTabViewThirdResponsibility; private Spinner spinnerDriverChair; private LinearLayout layoutCabSeatInsurance; private ImageView ivSDEWCabSeatInsurance; private TextView tvSDEWCabSeatInsurance; private SwitchButton switchTabViewCabChair; private Spinner spinnerPassageChair; private LinearLayout layoutPassengerSeatInsurance; private ImageView ivSDEWPassengerSeatInsurance; private TextView tvSDEWPassengerSeatInsurance; private SwitchButton switchTabViewPassengeChair; private LinearLayout layoutRobInsurance; private ImageView ivSDEWRobInsurance; private TextView tvSDEWRobInsurance; private SwitchButton switchTabViewRob; private LinearLayout layoutShadeLiningInsurance; private ImageView ivSDEWShadeLiningInsurance; private TextView tvSDEWShadeLiningInsurance; private SwitchButton switchTabViewShadeLining; private Spinner spinnerScratchesRisk; private LinearLayout layoutRiskOfScratchesInsurance; private ImageView ivSDEWRiskOfScratchesInsurance; private TextView tvSDEWRiskOfScratchesInsurance; private SwitchButton switchTabViewRiskOfScratches; private LinearLayout layoutRiskOfSpontaneousCombustionInsurance; private ImageView ivSDEWRiskOfSpontaneousCombustionInsurance; private TextView tvSDEWRiskOfSpontaneousCombustionInsurance; private SwitchButton switchTabViewRiskOfSpontaneousCombustion; private LinearLayout layoutRiskOfEngineWadingInsurance; private ImageView ivSDEWRiskOfEngineWadingInsurance; private TextView tvSDEWRiskOfEngineWadingInsurance; private SwitchButton switchTabViewRiskOfEngineWading; private LinearLayout layoutMotorVehicleLossAndThirdResponsibilityInsurance; private ImageView ivSDEWMotorVehicleLossAndThirdResponsibilityInsurance; private TextView tvSDEWMotorVehicleLossAndThirdResponsibilityInsurance; private SwitchButton switchMotorVehicleLossAndThirdResponsibilityInsurance; private TextView tvQuotaPrice; private TitleBar titleBar; private Spinner spinnerShadeLining; /** * Find the Views in the layout<br /> * <br /> * Auto-created on 2016-02-29 16:45:16 by Android Layout Finder * (http://www.buzzingandroid.com/tools/android-layout-finder) */ private void findViews() { layoutCommercialDatePicker = (LinearLayout) findViewById(R.id.layout_commercial_date_picker); tvCommercialStartDate = (TextView) findViewById(R.id.tv_commercial_start_date); layoutCompulsoryDatePicker = (LinearLayout) findViewById(R.id.layout_compulsory_date_picker); tvCompulsoryStartDate = (TextView) findViewById(R.id.tv_compulsory_start_date); layoutMotorVehicleLossInsurance = (LinearLayout) findViewById(R.id.layout_motor_vehicle_loss_insurance); ivSDEWMotorVehicleLossInsurance = (ImageView) findViewById(R.id.iv_SDEW_motor_vehicle_loss_insurance); tvSDEWMotorVehicleLossInsurance = (TextView) findViewById(R.id.tv_SDEW_motor_vehicle_loss_insurance); switchTabViewMotorVehicleLossInsurance = (SwitchButton) findViewById( R.id.switch_tab_view_motor_vehicle_loss_insurance); spinnerShadeLining = (Spinner) findViewById(R.id.spinner_shade_lining); spinnerThirdResponsibility = (Spinner) findViewById(R.id.spinner_third_responsibility); layoutThirdResponsibility = (LinearLayout) findViewById(R.id.layout_third_responsibility); ivSDEWThirdResponsibilityInsurance = (ImageView) findViewById(R.id.iv_SDEW_third_responsibility_insurance); tvSDEWThirdResponsibilityInsurance = (TextView) findViewById(R.id.tv_SDEW_third_responsibility_insurance); switchTabViewThirdResponsibility = (SwitchButton) findViewById(R.id.switch_tab_view_third_responsibility); spinnerDriverChair = (Spinner) findViewById(R.id.spinner_driver_chair); layoutCabSeatInsurance = (LinearLayout) findViewById(R.id.layout_cab_seat_insurance); ivSDEWCabSeatInsurance = (ImageView) findViewById(R.id.iv_SDEW_cab_seat_insurance); tvSDEWCabSeatInsurance = (TextView) findViewById(R.id.tv_SDEW_cab_seat_insurance); switchTabViewCabChair = (SwitchButton) findViewById(R.id.switch_tab_view_cab_chair); spinnerPassageChair = (Spinner) findViewById(R.id.spinner_passage_chair); layoutPassengerSeatInsurance = (LinearLayout) findViewById(R.id.layout_passenger_seat_insurance); ivSDEWPassengerSeatInsurance = (ImageView) findViewById(R.id.iv_SDEW_passenger_seat_insurance); tvSDEWPassengerSeatInsurance = (TextView) findViewById(R.id.tv_SDEW_passenger_seat_insurance); switchTabViewPassengeChair = (SwitchButton) findViewById(R.id.switch_tab_view_passenge_chair); layoutRobInsurance = (LinearLayout) findViewById(R.id.layout_rob_insurance); ivSDEWRobInsurance = (ImageView) findViewById(R.id.iv_SDEW_rob_insurance); tvSDEWRobInsurance = (TextView) findViewById(R.id.tv_SDEW_rob_insurance); switchTabViewRob = (SwitchButton) findViewById(R.id.switch_tab_view_rob); layoutShadeLiningInsurance = (LinearLayout) findViewById(R.id.layout_shade_lining_insurance); ivSDEWShadeLiningInsurance = (ImageView) findViewById(R.id.iv_SDEW_shade_lining_insurance); tvSDEWShadeLiningInsurance = (TextView) findViewById(R.id.tv_SDEW_shade_lining_insurance); switchTabViewShadeLining = (SwitchButton) findViewById(R.id.switch_tab_view_shade_lining); spinnerScratchesRisk = (Spinner) findViewById(R.id.spinner_scratches_risk); layoutRiskOfScratchesInsurance = (LinearLayout) findViewById(R.id.layout_risk_of_scratches_insurance); ivSDEWRiskOfScratchesInsurance = (ImageView) findViewById(R.id.iv_SDEW_risk_of_scratches_insurance); tvSDEWRiskOfScratchesInsurance = (TextView) findViewById(R.id.tv_SDEW_risk_of_scratches_insurance); switchTabViewRiskOfScratches = (SwitchButton) findViewById(R.id.switch_tab_view_risk_of_scratches); layoutRiskOfSpontaneousCombustionInsurance = (LinearLayout) findViewById( R.id.layout_risk_of_spontaneous_combustion_insurance); ivSDEWRiskOfSpontaneousCombustionInsurance = (ImageView) findViewById( R.id.iv_SDEW_risk_of_spontaneous_combustion_insurance); tvSDEWRiskOfSpontaneousCombustionInsurance = (TextView) findViewById( R.id.tv_SDEW_risk_of_spontaneous_combustion_insurance); switchTabViewRiskOfSpontaneousCombustion = (SwitchButton) findViewById( R.id.switch_tab_view_risk_of_spontaneous_combustion); layoutRiskOfEngineWadingInsurance = (LinearLayout) findViewById( R.id.layout_risk_of_engine_wading_insurance); ivSDEWRiskOfEngineWadingInsurance = (ImageView) findViewById(R.id.iv_SDEW_risk_of_engine_wading_insurance); tvSDEWRiskOfEngineWadingInsurance = (TextView) findViewById(R.id.tv_SDEW_risk_of_engine_wading_insurance); switchTabViewRiskOfEngineWading = (SwitchButton) findViewById(R.id.switch_tab_view_risk_of_engine_wading); layoutMotorVehicleLossAndThirdResponsibilityInsurance = (LinearLayout) findViewById( R.id.layout_motor_vehicle_loss_and_third_responsibility_insurance); ivSDEWMotorVehicleLossAndThirdResponsibilityInsurance = (ImageView) findViewById( R.id.iv_SDEW_motor_vehicle_loss_and_third_responsibility_insurance); tvSDEWMotorVehicleLossAndThirdResponsibilityInsurance = (TextView) findViewById( R.id.tv_SDEW_motor_vehicle_loss_and_third_responsibility_insurance); switchMotorVehicleLossAndThirdResponsibilityInsurance = (SwitchButton) findViewById( R.id.switch_motor_vehicle_loss_and_third_responsibility_insurance); tvQuotaPrice = (TextView) findViewById(R.id.tv_quota_price); titleBar = (TitleBar) findViewById(R.id.title_bar); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_insure_car_plan); activity = this; progressDialogUtil = new ProgressDialogUtil(activity); nf.setGroupingUsed(false); getIntentData(); findViews(); setUp(); setLisenter(); } private void getIntentData() { engineNumber = getIntent().getStringExtra("engineNumber"); licenseplate = getIntent().getStringExtra("licenseplate"); frameNumber = getIntent().getStringExtra("frameNumber"); ownerName = getIntent().getStringExtra("userName"); provnce_no = getIntent().getStringExtra("province_no"); provence = getIntent().getStringExtra("province_name"); city_no = getIntent().getStringExtra("city_no"); country_no = getIntent().getStringExtra("country_no"); model_code = getIntent().getStringExtra("model_code"); newValue = getIntent().getFloatExtra("newValue", 0); transfer = getIntent().getStringExtra("transfer"); transferDate = getIntent().getStringExtra("transferDate"); registrationDateString = getIntent().getStringExtra("registrationDateString"); issueDateString = getIntent().getStringExtra("issueDateString"); idcardNum = getIntent().getStringExtra("idcardNum"); } private void setLisenter() { titleBar.setOnTitleBarClickListener(new TitleBar.OnTitleBarClickListener() { @Override public void onLeftButtonClick(View v) { activity.finish(); } @Override public void onRightButtonClick(View v) { } }); setCommercialAndCompulsoryStartDateListener(); toQuotaPrice(); //?? // setLayoutOnClickListener(); setSwitchCheckedChangListener(); setSpinnerItemSelectedListener(); } /** * */ private void toQuotaPrice() { tvQuotaPrice.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int uid = PreferenceUtil.load(activity, PreferenceConstant.userid, -1); if (uid < 0) { Toast.makeText(activity, "???", Toast.LENGTH_SHORT).show(); LoginActivity.startLoginActivity(activity); return; } userid = uid + ""; if (TextUtils.isEmpty(transfer)) { transfer = "0"; } if (TextUtils.isEmpty(transferDate)) { transferDate = "0"; } insuranceItemDatas.clear(); //? if (flag_switch_SDEWMotorVehicleLossInsurance) { insuranceItemDatas.add(motor_vehicle_loss_insurance); } //? if (flag_switch_SDEWCabSeatInsurance) { insuranceItemDatas.add(cab_seat_insurance); } // if (flag_switch_SDEWPassengerSeatInsurance) { insuranceItemDatas.add(passenger_seat_insurance); } // if (flag_switch_SDEWRiskOfSpontaneousCombustionInsurance) { insuranceItemDatas.add(risk_of_spontaneous_combustion_insurance); } //? if (flag_switch_SDEWRiskOfEngineWadingInsurance) { insuranceItemDatas.add(risk_of_engine_wading_insurance); } // if (flag_switch_SDEWRiskOfScratchesInsurance) { insuranceItemDatas.add(risk_of_scratches_insurance); } // if (flag_switch_SDEWRobInsurance) { insuranceItemDatas.add(rob_insurance); } // if (flag_switch_SDEWShadeLiningInsurance) { insuranceItemDatas.add(shade_lining_insurance); } // if (flag_switch_SDEWThirdResponsibilityInsurance) { insuranceItemDatas.add(third_responsibility_insurance); } Gson gson = new GsonBuilder().registerTypeAdapter(Double.class, new JsonSerializer<Double>() { @Override public JsonElement serialize(Double src, Type typeOfSrc, JsonSerializationContext context) { if (src == src.doubleValue()) return new JsonPrimitive(nf.format(src.doubleValue())); else if (src == src.longValue()) return new JsonPrimitive(nf.format(src.longValue())); return new JsonPrimitive(nf.format(src)); } }).create(); insuranceItems = gson.toJson(insuranceItemDatas); progressDialogUtil.show("???..."); //2 UserRetrofitUtil.quotaPrice(activity, userid, licenseplate, engineNumber, frameNumber, seatingcapacity, newValue + "", model_code, registrationDateString, ownerName, commercestartdate + "", compulsorystartdate + "", issueDateString, provence, provnce_no, city_no, country_no, transfer, transferDate, idcardNum, phone, compulsoryAmt, insuranceItems, type, glassType, new NetCallback<NetWorkResultBean<Object>>(activity) { @Override public void onFailure(RetrofitError error, String message) { progressDialogUtil.hide(); Toast.makeText(activity, "", Toast.LENGTH_SHORT).show(); } @Override public void success(NetWorkResultBean<Object> commPriceDataNetWorkResultBean, Response response) { progressDialogUtil.hide(); if (commPriceDataNetWorkResultBean != null) { int status = commPriceDataNetWorkResultBean.getStatus(); switch (status) { case HttpsURLConnection.HTTP_OK: if (commPriceDataNetWorkResultBean.getData() != null) { CommPriceData bean = null; Object obj = commPriceDataNetWorkResultBean.getData(); if (obj instanceof String) { Toast.makeText(activity, commPriceDataNetWorkResultBean.getMessage().toString(), Toast.LENGTH_LONG).show(); return; } try { String json = com.jiandanbaoxian.util.JsonUtil.toJson(obj); bean = com.jiandanbaoxian.util.JsonUtil.fromJson(json, CommPriceData.class); } catch (Exception e) { Log.e("qw", "???!"); } if (bean == null) { Toast.makeText(activity, "?", Toast.LENGTH_LONG) .show(); return; } PriceReportActivity.startActivity(activity, bean, idcardNum, city_no, country_no, provnce_no, compulsorystartdate, commercestartdate); } break; default: Toast.makeText(activity, commPriceDataNetWorkResultBean.getMessage().toString(), Toast.LENGTH_LONG).show(); break; } } } }); } }); } private void setCommercialAndCompulsoryStartDateListener() { layoutCommercialDatePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Calendar calendar = Calendar.getInstance(); new DatePickerDialog(activity, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { tvCommercialStartDate.setText(year + "-" + (++monthOfYear) + "-" + dayOfMonth); String mm = "" + monthOfYear; String dd = "" + dayOfMonth; if (monthOfYear < 10 && mm.length() == 1) { mm = "0" + mm; } if (dayOfMonth < 10 && dd.length() == 1) { dd = "0" + dd; } try { commercestartdate = dateFormat_yyyy_MM_dd.parse(year + "-" + mm + "-" + dd).getTime(); } catch (ParseException e) { commercestartdate = 0L; e.printStackTrace(); Toast.makeText(activity, "Error in convert time !", Toast.LENGTH_LONG).show(); } finally { } } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)) .show(); } }); layoutCompulsoryDatePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Calendar calendar = Calendar.getInstance(); new DatePickerDialog(activity, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { tvCompulsoryStartDate.setText(year + "-" + (++monthOfYear) + "-" + dayOfMonth); String mm = "" + monthOfYear; String dd = "" + dayOfMonth; if (monthOfYear < 10 && mm.length() == 1) { mm = "0" + mm; } if (dayOfMonth < 10 && dd.length() == 1) { dd = "0" + dd; } try { compulsorystartdate = dateFormat_yyyy_MM_dd.parse(year + "-" + mm + "-" + dd).getTime(); } catch (ParseException e) { compulsorystartdate = 0L; e.printStackTrace(); Toast.makeText(activity, "Error in convert time !", Toast.LENGTH_LONG).show(); } finally { } } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)) .show(); } }); } // private void setLayoutOnClickListener() { // layoutCabSeatInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWCabSeatInsurance) { // if (flag_layout_SDEWCabSeatInsurance) { // cab_seat_insurance.setFranchise_flag(1);//?? // // flag_layout_SDEWCabSeatInsurance = false; // ivSDEWCabSeatInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWCabSeatInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // cab_seat_insurance.setFranchise_flag(-1);//?? // // flag_layout_SDEWCabSeatInsurance = true; // ivSDEWCabSeatInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWCabSeatInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // layoutMotorVehicleLossInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWMotorVehicleLossInsurance) { // if (flag_layout_SDEWMotorVehicleLossInsurance) { // motor_vehicle_loss_insurance.setFranchise_flag(1);//?? // // flag_layout_SDEWMotorVehicleLossInsurance = false; // ivSDEWMotorVehicleLossInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWMotorVehicleLossInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // motor_vehicle_loss_insurance.setFranchise_flag(-1); // // flag_layout_SDEWMotorVehicleLossInsurance = true; // ivSDEWMotorVehicleLossInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWMotorVehicleLossInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // layoutPassengerSeatInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWPassengerSeatInsurance) { // if (flag_layout_SDEWPassengerSeatInsurance) { // passenger_seat_insurance.setFranchise_flag(1);//?? // // flag_layout_SDEWPassengerSeatInsurance = false; // ivSDEWPassengerSeatInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWPassengerSeatInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // passenger_seat_insurance.setFranchise_flag(-1);//?? // // flag_layout_SDEWPassengerSeatInsurance = true; // ivSDEWPassengerSeatInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWPassengerSeatInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // // layoutRobInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWRobInsurance) { // if (flag_layout_SDEWRobInsurance) { // rob_insurance.setFranchise_flag(1);//?? // // flag_layout_SDEWRobInsurance = false; // ivSDEWRobInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWRobInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // rob_insurance.setFranchise_flag(-1);//?? // // flag_layout_SDEWRobInsurance = true; // ivSDEWRobInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWRobInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // // layoutThirdResponsibility.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWThirdResponsibilityInsurance) { // if (flag_layout_SDEWThirdResponsibilityInsurance) { // third_responsibility_insurance.setFranchise_flag(1);//?? // // flag_layout_SDEWThirdResponsibilityInsurance = false; // ivSDEWThirdResponsibilityInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWThirdResponsibilityInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // third_responsibility_insurance.setFranchise_flag(-1);//?? // // flag_layout_SDEWThirdResponsibilityInsurance = true; // ivSDEWThirdResponsibilityInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWThirdResponsibilityInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // // // // layoutShadeLiningInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWShadeLiningInsurance) { // if (flag_layout_SDEWShadeLiningInsurance) { // shade_lining_insurance.setFranchise_flag(1);//?? // flag_layout_SDEWShadeLiningInsurance = false; // ivSDEWShadeLiningInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWShadeLiningInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // shade_lining_insurance.setFranchise_flag(-1);//?? // flag_layout_SDEWShadeLiningInsurance = true; // ivSDEWShadeLiningInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWShadeLiningInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // // // layoutRiskOfSpontaneousCombustionInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWRiskOfSpontaneousCombustionInsurance) { // if (flag_layout_SDEWRiskOfSpontaneousCombustionInsurance) { // risk_of_spontaneous_combustion_insurance.setFranchise_flag(1);//?? // flag_layout_SDEWRiskOfSpontaneousCombustionInsurance = false; // ivSDEWRiskOfSpontaneousCombustionInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWRiskOfSpontaneousCombustionInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // risk_of_spontaneous_combustion_insurance.setFranchise_flag(-1); // flag_layout_SDEWRiskOfSpontaneousCombustionInsurance = true; // ivSDEWRiskOfSpontaneousCombustionInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWRiskOfSpontaneousCombustionInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // layoutRiskOfScratchesInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWRiskOfScratchesInsurance) { // if (flag_layout_SDEWRiskOfScratchesInsurance) { // risk_of_scratches_insurance.setFranchise_flag(1);//?? // flag_layout_SDEWRiskOfScratchesInsurance = false; // ivSDEWRiskOfScratchesInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWRiskOfScratchesInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // risk_of_scratches_insurance.setFranchise_flag(-1);//?? // flag_layout_SDEWRiskOfScratchesInsurance = true; // ivSDEWRiskOfScratchesInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWRiskOfScratchesInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // // // layoutRiskOfEngineWadingInsurance.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (flag_switch_SDEWRiskOfEngineWadingInsurance) { // if (flag_layout_SDEWRiskOfEngineWadingInsurance) { // risk_of_engine_wading_insurance.setFranchise_flag(1);//?? // flag_layout_SDEWRiskOfEngineWadingInsurance = false; // ivSDEWRiskOfEngineWadingInsurance.setImageResource(R.drawable.icon_choose); // tvSDEWRiskOfEngineWadingInsurance.setTextColor(Color.parseColor("#f0f0f0")); // } else { // risk_of_engine_wading_insurance.setFranchise_flag(-1);//?? // flag_layout_SDEWRiskOfEngineWadingInsurance = true; // ivSDEWRiskOfEngineWadingInsurance.setImageResource(R.drawable.icon_choose_selected); // tvSDEWRiskOfEngineWadingInsurance.setTextColor(Color.parseColor("#0b0b0b")); // } // } // } // }); // } private void setSwitchCheckedChangListener() { //? //switch button switchTabViewMotorVehicleLossInsurance .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { //? ? ? ? if (!isChecked) { switchTabViewRob.setChecked(false); switchTabViewRiskOfSpontaneousCombustion.setChecked(false); switchTabViewRiskOfScratches.setChecked(false); switchTabViewRiskOfEngineWading.setChecked(false); switchTabViewShadeLining.setChecked(false); } flag_switch_SDEWMotorVehicleLossInsurance = isChecked; motor_vehicle_loss_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWMotorVehicleLossInsurance = isChecked; ivSDEWMotorVehicleLossInsurance.setImageResource( isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWMotorVehicleLossInsurance .setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); // switchTabViewThirdResponsibility.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWThirdResponsibilityInsurance = isChecked; third_responsibility_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWThirdResponsibilityInsurance = isChecked; ivSDEWThirdResponsibilityInsurance .setImageResource(isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWThirdResponsibilityInsurance .setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); //?? switchTabViewCabChair.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWCabSeatInsurance = isChecked; cab_seat_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWCabSeatInsurance = isChecked; ivSDEWCabSeatInsurance .setImageResource(isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWCabSeatInsurance.setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); //? switchTabViewPassengeChair.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWPassengerSeatInsurance = isChecked; passenger_seat_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWPassengerSeatInsurance = isChecked; ivSDEWPassengerSeatInsurance .setImageResource(isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWPassengerSeatInsurance.setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); // switchTabViewRob.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWRobInsurance = isChecked; rob_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWRobInsurance = isChecked; ivSDEWRobInsurance .setImageResource(isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWRobInsurance.setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); // switchTabViewShadeLining.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWShadeLiningInsurance = isChecked; shade_lining_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWShadeLiningInsurance = isChecked; ivSDEWShadeLiningInsurance .setImageResource(isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWShadeLiningInsurance.setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); // switchTabViewRiskOfSpontaneousCombustion .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWRiskOfSpontaneousCombustionInsurance = isChecked; risk_of_spontaneous_combustion_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWRiskOfSpontaneousCombustionInsurance = isChecked; ivSDEWRiskOfSpontaneousCombustionInsurance.setImageResource( isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWRiskOfSpontaneousCombustionInsurance .setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); // switchTabViewRiskOfScratches.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWRiskOfScratchesInsurance = isChecked; risk_of_scratches_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWRiskOfScratchesInsurance = isChecked; ivSDEWRiskOfScratchesInsurance .setImageResource(isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWRiskOfScratchesInsurance.setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); //? switchTabViewRiskOfEngineWading.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { flag_switch_SDEWRiskOfEngineWadingInsurance = isChecked; risk_of_engine_wading_insurance.setFranchise_flag(isChecked ? 1 : -1); //switch???????? // flag_layout_SDEWRiskOfEngineWadingInsurance = isChecked; ivSDEWRiskOfEngineWadingInsurance .setImageResource(isChecked ? R.drawable.icon_choose_selected : R.drawable.icon_choose); tvSDEWRiskOfEngineWadingInsurance.setTextColor(Color.parseColor(isChecked ? "#0b0b0b" : "#f0f0f0")); } }); } public void setSpinnerItemSelectedListener() { // spinner spinnerScratchesRisk.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String key = valuesOfScratchesInsurance.get(position); double value = hashRiskOfScratchesInsurance.get(key); risk_of_scratches_insurance.setAmt(value); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); // spinnerThirdResponsibility.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String key = valuesOfThirdResponsibilityInsurance.get(position); double value = hashThridResponsibilityInsurance.get(key); third_responsibility_insurance.setAmt(value); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); //?? spinnerDriverChair.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String key = valuesOfCabSeatInsurance.get(position); cab_seat_insurance.setAmt(hashCabSeatInsurance.get(key)); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); //? spinnerPassageChair.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String key = valuesOfPassengerSeatInsurance.get(position); passenger_seat_insurance.setAmt(hashPassengerInsurance.get(key)); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); // spinnerShadeLining.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String key = valuesOfShadeLiningInsurance.get(position); try { glassType = nf.format(hashShadelining.get(key)) + ""; } catch (Exception e) { glassType = hashShadelining.get(key) + ""; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } private void setUp() { titleBar.initTitleBarInfo("?", R.drawable.arrow_left, -1, "", ""); setSpinnerData(); setSwitchCheckedDefault(); setInsuranceItems(); } private void setSpinnerData() { // spinner hashRiskOfScratchesInsurance.put("2?", 365001d); hashRiskOfScratchesInsurance.put("5?", 365002d); hashRiskOfScratchesInsurance.put("1", 365003d); hashRiskOfScratchesInsurance.put("2", 365004d); valuesOfScratchesInsurance.addAll(hashRiskOfScratchesInsurance.keySet()); spinnerAdapterRiskOfScratchesInsurance = new SpinnerDropDownAdapter(activity, valuesOfScratchesInsurance); spinnerScratchesRisk.setAdapter(spinnerAdapterRiskOfScratchesInsurance); // spinner hashThridResponsibilityInsurance.put("20", 306006006d); hashThridResponsibilityInsurance.put("30", 306006007d); hashThridResponsibilityInsurance.put("50", 306006009d); hashThridResponsibilityInsurance.put("100", 306006014d); valuesOfThirdResponsibilityInsurance.addAll(hashThridResponsibilityInsurance.keySet()); spinnerAdapterThirdResponsibilityInsurance = new SpinnerDropDownAdapter(activity, valuesOfThirdResponsibilityInsurance); spinnerThirdResponsibility.setAdapter(spinnerAdapterThirdResponsibilityInsurance); //?? hashCabSeatInsurance.put("1", 10000d); hashCabSeatInsurance.put("2", 20000d); hashCabSeatInsurance.put("5", 50000d); hashCabSeatInsurance.put("10", 100000d); valuesOfCabSeatInsurance.addAll(hashCabSeatInsurance.keySet()); spinnerAdapterCabSeatInsurance = new SpinnerDropDownAdapter(activity, valuesOfCabSeatInsurance); spinnerDriverChair.setAdapter(spinnerAdapterCabSeatInsurance); //? hashPassengerInsurance.put("1", 10000d); hashPassengerInsurance.put("2", 20000d); hashPassengerInsurance.put("5", 50000d); hashPassengerInsurance.put("10", 100000d); valuesOfPassengerSeatInsurance.addAll(hashPassengerInsurance.keySet()); spinnerAdapterPassengerSeatInsurance = new SpinnerDropDownAdapter(activity, valuesOfPassengerSeatInsurance); spinnerPassageChair.setAdapter(spinnerAdapterPassengerSeatInsurance); // hashShadelining.put("", 303011001d); hashShadelining.put("?", 303011002d); glassType = "303011001"; valuesOfShadeLiningInsurance.addAll(hashShadelining.keySet()); spinnerAdapterShadeLiningInsurance = new SpinnerDropDownAdapter(activity, valuesOfShadeLiningInsurance); spinnerShadeLining.setAdapter(spinnerAdapterShadeLiningInsurance); } private void setSwitchCheckedDefault() { switchTabViewMotorVehicleLossInsurance.setChecked(true); switchTabViewCabChair.setChecked(true); switchTabViewPassengeChair.setChecked(true); switchTabViewThirdResponsibility.setChecked(true); switchTabViewRob.setChecked(false); switchTabViewShadeLining.setChecked(false); switchTabViewRiskOfSpontaneousCombustion.setChecked(false); switchTabViewRiskOfScratches.setChecked(false); switchTabViewRiskOfEngineWading.setChecked(false); } private void setInsuranceItems() { //???? motor_vehicle_loss_insurance.setInsrnc_name("?");//??? motor_vehicle_loss_insurance.setPremium(-1f);//??????? motor_vehicle_loss_insurance.setRemark("");// motor_vehicle_loss_insurance.setInsrnc_cde("030101");//?? motor_vehicle_loss_insurance.setC_ly15(-1);//????? motor_vehicle_loss_insurance.setFranchise_flag(1);//??? motor_vehicle_loss_insurance.setNumber(-1);//? motor_vehicle_loss_insurance.setBullet_glass(-1);//? motor_vehicle_loss_insurance.setAmt(newValue);//???String Array ? ??? // third_responsibility_insurance.setInsrnc_name("");//??? third_responsibility_insurance.setPremium(-1f);//??????? third_responsibility_insurance.setRemark("");// third_responsibility_insurance.setInsrnc_cde("030102");//?? third_responsibility_insurance.setC_ly15(-1);//????? third_responsibility_insurance.setNumber(-1);//? third_responsibility_insurance.setFranchise_flag(1);//??? third_responsibility_insurance.setBullet_glass(-1);//? third_responsibility_insurance.setAmt(306006006d);// ???String Array ? ??? // rob_insurance.setInsrnc_name("");//??? rob_insurance.setPremium(-1f);//??????? rob_insurance.setRemark("");// rob_insurance.setInsrnc_cde("030103");//?? rob_insurance.setNumber(-1);//? rob_insurance.setC_ly15(-1);//????? rob_insurance.setFranchise_flag(1);//??? rob_insurance.setBullet_glass(-1);//? rob_insurance.setAmt(newValue);//? ???String Array ? ??? //?? cab_seat_insurance.setInsrnc_name("??");//??? cab_seat_insurance.setPremium(-1f);//??????? cab_seat_insurance.setRemark("");// cab_seat_insurance.setInsrnc_cde("030104");//?? cab_seat_insurance.setC_ly15(-1);//????? cab_seat_insurance.setFranchise_flag(1);//??? cab_seat_insurance.setNumber(-1);//? cab_seat_insurance.setBullet_glass(-1);//? cab_seat_insurance.setAmt(1d);//???String Array ? ??? //? passenger_seat_insurance.setInsrnc_name("?");//??? passenger_seat_insurance.setPremium(-1f);//??????? passenger_seat_insurance.setRemark("");// passenger_seat_insurance.setInsrnc_cde("030105");//?? passenger_seat_insurance.setC_ly15(-1);//????? passenger_seat_insurance.setNumber(-1);//? passenger_seat_insurance.setFranchise_flag(1);//??? passenger_seat_insurance.setBullet_glass(-1);//? passenger_seat_insurance.setAmt(1d);//???String Array ? ??? // // shade_lining_insurance.setInsrnc_name("");//??? shade_lining_insurance.setPremium(-1f);//??????? shade_lining_insurance.setRemark("");// shade_lining_insurance.setInsrnc_cde("303011001");//?? shade_lining_insurance.setC_ly15(-1);//????? shade_lining_insurance.setFranchise_flag(1);//??? shade_lining_insurance.setBullet_glass(-1);//? shade_lining_insurance.setNumber(-1);//? shade_lining_insurance.setAmt(0d);//???String Array ? ??? // risk_of_spontaneous_combustion_insurance.setInsrnc_name("");//??? risk_of_spontaneous_combustion_insurance.setPremium(-1f);//??????? risk_of_spontaneous_combustion_insurance.setRemark("");// risk_of_spontaneous_combustion_insurance.setInsrnc_cde("030108");//?? risk_of_spontaneous_combustion_insurance.setC_ly15(-1);//????? risk_of_spontaneous_combustion_insurance.setFranchise_flag(1);//??? risk_of_spontaneous_combustion_insurance.setBullet_glass(-1);//? risk_of_spontaneous_combustion_insurance.setNumber(-1);//? risk_of_spontaneous_combustion_insurance.setAmt(newValue);//???String Array ? ??? // risk_of_scratches_insurance.setInsrnc_name("");//??? risk_of_scratches_insurance.setPremium(-1f);//??????? risk_of_scratches_insurance.setRemark("");// risk_of_scratches_insurance.setInsrnc_cde("030110");//?? risk_of_scratches_insurance.setC_ly15(-1);//????? risk_of_scratches_insurance.setFranchise_flag(1);//??? risk_of_scratches_insurance.setBullet_glass(-1);//? risk_of_scratches_insurance.setNumber(-1);//? risk_of_scratches_insurance.setAmt(365001d);//???String Array ? ??? //? risk_of_engine_wading_insurance.setInsrnc_name("?");//??? risk_of_engine_wading_insurance.setPremium(-1f);//??????? risk_of_engine_wading_insurance.setRemark("");// risk_of_engine_wading_insurance.setInsrnc_cde("030111");//?? risk_of_engine_wading_insurance.setC_ly15(-1);//????? risk_of_engine_wading_insurance.setFranchise_flag(1);//??? risk_of_engine_wading_insurance.setBullet_glass(-1);//? risk_of_engine_wading_insurance.setNumber(-1);//? risk_of_engine_wading_insurance.setAmt(0D);//???String Array ? ??? } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (data != null) { CommPriceData commPriceData = data.getParcelableExtra("CommPriceData"); if (commPriceData != null) { } } super.onActivityResult(requestCode, resultCode, data); } @Override protected void onPause() { super.onPause(); PreferenceUtil.save(this, PreferenceConstant.commercestartdate, commercestartdate); PreferenceUtil.save(this, PreferenceConstant.compulsorystartdate, compulsorystartdate); } @Override protected void onResume() { super.onResume(); commercestartdate = PreferenceUtil.load(this, PreferenceConstant.commercestartdate, 0L); compulsorystartdate = PreferenceUtil.load(this, PreferenceConstant.compulsorystartdate, 0L); if (commercestartdate > 0) { tvCommercialStartDate.setText(dateFormat_yyyy_MM_dd.format(new Date(commercestartdate)) + ""); } if (compulsorystartdate > 0) { tvCompulsoryStartDate.setText(dateFormat_yyyy_MM_dd.format(new Date(compulsorystartdate)) + ""); } } }