1

我一直在使用来自这个https://github.com/shivasurya/materialsteppers的材料步进器

我有 3 个步骤,每个步骤都包含表单,问题是,在最后一步时,我无法获取表单数据。下面是我的代码,我在第 1 步和第 2 步中使用了相同的方法。

这是我的最后一步代码

public OnFragmentPassing mOnFragmentPassing;

@Override
public boolean onNextButtonHandler() {
    Toast.makeText(getContext(), "test", Toast.LENGTH_SHORT).show();
    String dataNamaToko = txtNamaToko.getText().toString();
    String jenisToko = txtJenisToko.getSelectedItem().toString();
    String alamatToko = txtUkmAddress.getText().toString();
    String provinceToko = getProvinceId;
    String cityToko = getCityId;
    String kecamatanToko = getDistrictId;
    String kelurahanToko = getSubDistrictId;
    String postalCodeToko = txtUkmPostalCode.getText().toString();

    mOnFragmentPassing.sendUkmName(dataNamaToko);
    mOnFragmentPassing.sendUkmType(jenisToko);
    mOnFragmentPassing.sendUkmAddress(alamatToko);
    mOnFragmentPassing.sendUkmAddressProvince(provinceToko);
    mOnFragmentPassing.sendUkmAddressCity(cityToko);
    mOnFragmentPassing.sendUkmAddressDistrict(kecamatanToko);
    mOnFragmentPassing.sendUkmAddressSubDistrict(kelurahanToko);
    mOnFragmentPassing.sendUkmPostalCode(postalCodeToko);


    return true;
}

这是我的界面代码

public interface OnFragmentPassing {
void sendPersonalName(String personalName);
void sendDob(String dob);
void sendGender(String gender);
void sendNikData(String nik);
//void sendEmail(String email);
void sendPhone(String phoneNumber);
void sendAddress(String address);
void sendAddressProvince(String province);
void sendAddressCity(String city);
void sendAddressDistrict(String district);
void sendAddressSubDistrict(String subDistrict);
void sendAddressPostalCode(String postalCode);
void sendUkmName(String ukmName);
void sendUkmType(String ukmType);
void sendUkmAddress(String ukmAddress);
void sendUkmAddressProvince(String ukmProvince);
void sendUkmAddressCity(String ukmCity);
void sendUkmAddressDistrict(String ukmDistrict);
void sendUkmAddressSubDistrict(String ukmSubDistrict);
void sendUkmPostalCode(String ukmPostalCode);

}

这是我的主要活动,我将第 1 步的数据传递到此活动的第 3 步

public void onStepperCompleted() {
    showCompletedDialog();
}

protected void showCompletedDialog(){
    //Toast.makeText(this, "nama "+ mPersonalName + mNamaToko, Toast.LENGTH_SHORT).show();
    String category = "1";
    String photo = "http://google.com";
    String email = getIntent().getStringExtra("emailUkmRegistration");

    UkmRegistrationRequest ukmRegistrationRequest = new UkmRegistrationRequest(category, mPersonalName, mPersonalDob, mPersonalGender, mPersonalNik,
            photo, email, mPersonalPhone, mPersonalAddress, mPersonalProvince, mPersonalCity, mPersonalDistrict, mPersonalSubDistrict,
            mPersonalPostalCode, mUkmName, mUkmType, mUkmAddress, mUkmProvince, mUkmCity, mUkmDistrict, mUkmSubDistrict, mUkmPostalCode);

    Call<UkmRegistrationResponse> call = apiService.ukmRegistrationResponse(ukmRegistrationRequest);

    call.enqueue(new Callback<UkmRegistrationResponse>() {
        @Override
        public void onResponse(Call<UkmRegistrationResponse> call, Response<UkmRegistrationResponse> response) {
            String status = response.body().getData().getStatus();
            Toast.makeText(UkmRegistrationForm.this, "status : "+ status, Toast.LENGTH_SHORT).show();
            redirectCheckEmail();
        }

        @Override
        public void onFailure(Call<UkmRegistrationResponse> call, Throwable t) {
            Toast.makeText(UkmRegistrationForm.this, "Failed Registration !", Toast.LENGTH_SHORT).show();
        }
    });

}
4

0 回答 0