public class personalData extends AppCompatActivity {
EditText[] mUserPersonalInfo = new EditText[7] ; // 0=FULL_NAME
RadioGroup mSex; // 1 =BIRTHDAY
Button mNext; //2=ADDRESS_LINE
TextView mback; // 3=CITY
//4=STATE
FirebaseAuth mAuth; // 5=PINCODE
// 6=EMAIL
ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_personal_data);
progressDialog = new ProgressDialog(this);
// 0=FULL_NAME
// 1 =BIRTHDAY
//2=ADDRESS_LINE
// 3=CITY
//4=STATE
// 5=PINCODE
// 6=EMAIL
mUserPersonalInfo[0] = findViewById(R.id.user_name);
mUserPersonalInfo[1]=findViewById(R.id.user_birth_date);
mUserPersonalInfo[2]=findViewById(R.id.user_address_line);
mUserPersonalInfo[3]=findViewById(R.id.user_city);
mUserPersonalInfo[4]=findViewById(R.id.user_state);
mUserPersonalInfo[5] = findViewById(R.id.user_email);
mUserPersonalInfo[6] = findViewById(R.id.user_pincode);
mAuth = FirebaseAuth.getInstance();
mSex=findViewById(R.id.user_sex);
mNext = findViewById(R.id.personal_details_next_button);
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
mNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String Birthday = mUserPersonalInfo[1].getText().toString();
final String Name = mUserPersonalInfo[0].getText().toString();
final String Addressline = mUserPersonalInfo[2].getText().toString();
final String City = mUserPersonalInfo[3].getText().toString();
final String State = mUserPersonalInfo[4].getText().toString();
final String Email = mUserPersonalInfo[5].getText().toString();
final String Pincode = mUserPersonalInfo[6].getText().toString();
int selectedRadioButton = mSex.getCheckedRadioButtonId();
final RadioButton selectedSex = findViewById(selectedRadioButton);
//checking if empty or not
for (int i = 0; i < 7; i++) {
if (mUserPersonalInfo[i].getText().toString().isEmpty()) {
mUserPersonalInfo[i].setError("Error");
mUserPersonalInfo[i].requestFocus();
return;
}
}
// checking if pincode is correct or not
if (Pincode.length() != 6) {
mUserPersonalInfo[5].setError("Enter valid Pincode");
mUserPersonalInfo[5].requestFocus();
return;
}
DatabaseReference currentUserDb = FirebaseDatabase.getInstance().getReference("USERS");
DatabaseReference mperosnal_details = currentUserDb.child(userID).child("PERSONAL_DETAILS");
mperosnal_details.child("BIRTHDAY").setValue(Birthday);
mperosnal_details.child("EMAIL").setValue(Email);
mperosnal_details.child("FULL_NAME").setValue(Name);
mperosnal_details.child("GENDER").setValue(selectedSex.getText().toString());
// set address details
DatabaseReference mperosnal_details_permanent_address = currentUserDb.child(userID).child("PERSONAL_DETAILS").child("PERMANENT_ADDRESS");
mperosnal_details_permanent_address.child("ADDRESS_LINE").setValue(Addressline);
mperosnal_details_permanent_address.child("PINCODE").setValue(Pincode);
mperosnal_details_permanent_address.child("STATE").setValue(State);
mperosnal_details_permanent_address.child("CITY").setValue(City);
Intent intent = new Intent(personalData.this, professionalData.class);
startActivity(intent);
}
});
}
}
我到处搜索过,但是找不到任何解决方案可以帮助我?
这些是我遇到的错误
C:\ Users \ f2016 \ Downloads \ android_source \ Teepe \ app \ src \ main \ java \ com \ teepe \ teepe \ KYC \ personalData.java:使用或覆盖已弃用的API。用-Xlint:deprecation重新编译 有关详细信息。
原因:com.android.builder.dexing.DexArchiveBuilderException: 处理失败 C:\ Users \ f2016.gradle \ caches \ transforms-2 \ files-2.1 \ 0696be8ea4b9a49005ad89d3832c9ecc \ jars \ classes.jar
原因:com.android.builder.dexing.DexArchiveBuilderException: 删除时出错。
原因:com.android.tools.r8.CompilationFailedException: 编译无法完成
原因:com.android.tools.r8.utils.AbortException:错误: 仅从Android O(--min-api 26)