Android + 尝试保存时出现解析错误
Android + Parse error when trying saving
我正在做一个实际上包含在 CRUD 中的应用程序。
碰巧在填写表格并保存信息后,应用程序崩溃了,我不知道为什么。
这是我得到的日志:
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded class_id=gralloc
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded name=gralloc
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded prop_name=ro.hardware.gralloc
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded for circle execute
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH2=/vendor/lib64/hw, name=gralloc, subname=mt6735
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH1=/system/lib64/hw, name=gralloc, subname=mt6735
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists return ENOENT
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH2=/vendor/lib64/hw, name=gralloc, subname=MT6737T
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH1=/system/lib64/hw, name=gralloc, subname=MT6737T
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists return ENOENT
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH2=/vendor/lib64/hw, name=gralloc, subname=mt6737t
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH1=/system/lib64/hw, name=gralloc, subname=mt6737t
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded HAL id=gralloc path=/system/lib64/hw/gralloc.mt6737t.so
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp I/[MALI][Gralloc]: [+]r_hnd(0x7f7d738220), client(27), share_fd(43)
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp D/GraphicBuffer: register, handle(0x7f7d738220) (w:720 h:1280 s:720 f:0x1 u:0x000b00)
当我调用这个方法时,应用程序崩溃了:
public void onStudentCreated() {
Student student = new Student();
EditText studentNameEditText = (EditText) findViewById(R.id.editTextStudentName);
EditText studentAgeEditText = (EditText) findViewById(R.id.editTextStudentAge);
EditText studentSchoolEditText = (EditText) findViewById(R.id.editTextStudentSchool);
EditText studentAddressEditText = (EditText) findViewById(R.id.editTextStudentAddress);
EditText studentParentNameEditText = (EditText) findViewById(R.id.editTextStudentParentName);
EditText studentParentCellphoneEditText = (EditText) findViewById(R.id.editTextStudentParentCellphone);
EditText studentParentPhoneEditText = (EditText) findViewById(R.id.editTextStudentParentPhone);
EditText studentParentEmailEditText = (EditText) findViewById(R.id.editTextStudentParentEmail);
String studentName = studentNameEditText.getText().toString();
String studentAge = studentAgeEditText.getText().toString();
String studentSchool = studentSchoolEditText.getText().toString();
String studentAddress = studentAddressEditText.getText().toString();
String studentCity = spinner.getSelectedItem().toString();
String studentParentName = studentParentNameEditText.getText().toString();
String studentParenteCellphone = studentParentCellphoneEditText.getText().toString();
String studentParentPhone = studentParentPhoneEditText.getText().toString();
String studentParentEmail = studentParentEmailEditText.getText().toString();
student.setStudentName(studentName);
student.setStudentAge(studentAge);
student.setStudentSchool(studentSchool);
student.setStudentAddress(studentAddress);
student.setStudentCity(studentCity);
student.setStudentParentName(studentParentName);
student.setStudentParentCellphone(studentParenteCellphone);
student.setStudentParentPhone(studentParentPhone);
student.setStudentParentEmail(studentParentEmail);
}
最后,这是我的模型:
@ParseClassName("Student")
public class Student extends ParseObject {
public String getStudentName() {
return getString(getStudentNameTitle());
}
public void setStudentName(String studentName) {
put(getStudentNameTitle(), studentName);
}
public String getStudentAge() {
return getString(getStudentAgeTitle());
}
public void setStudentAge(String studentAge) {
put(getStudentAgeTitle(), studentAge);
}
public String getStudentAddress() {
return getString(getStudentAddressTitle());
}
public void setStudentAddress(String studentAddress) {
put(getStudentAddressTitle(), studentAddress);
}
public String getStudentCity() {
return getString(getStudentCityTitle());
}
public void setStudentCity(String studentCity) {
put(getStudentCityTitle(), studentCity);
}
public String getStudentSchoolYear() {
return getString(getStudentSchoolYearTitle());
}
public void setStudentSchoolYear(String studentSchoolYear) {
put(getStudentSchoolYearTitle(), studentSchoolYear);
}
public String getStudentSchool() {
return getString(getStudentSchoolTitle());
}
public void setStudentSchool(String studentSchool) {
put(getStudentSchoolTitle(), studentSchool);
}
public String getStudentParentName() {
return getString(getStudentParentNameTitle());
}
public void setStudentParentName(String studentParentName) {
put(getStudentParentNameTitle(), studentParentName);
}
public String getStudentParentPhone() {
return getString(getStudentParentPhoneTitle());
}
public void setStudentParentPhone(String studentParentPhone) {
put(getStudentParentPhoneTitle(), studentParentPhone);
}
public String getStudentParentCellphone() {
return getString(getStudentParentCellphoneTitle());
}
public void setStudentParentCellphone (String studentParentCellphone) {
put(getStudentParentCellphoneTitle(), studentParentCellphone);
}
public String getStudentParentEmail() {
return getString(getStudentParentEmailTitle());
}
public void setStudentParentEmail(String studentParentEmail) {
put(getStudentParentEmailTitle(), studentParentEmail);
}
public static ParseQuery<Student> getQuery() {
return ParseQuery.getQuery(Student.class);
}
public static String getStudentNameTitle() {
return "nome_aluno";
}
private static String getStudentAgeTitle() {
return "idade_aluno";
}
private static String getStudentAddressTitle() {
return "endereco_aluno";
}
private static String getStudentCityTitle() {
return "cidade_aluno";
}
private static String getStudentSchoolYearTitle() {
return "serie_aluno";
}
private static String getStudentSchoolTitle() {
return "colegio_aluno";
}
private static String getStudentParentNameTitle() {
return "nome_pai_aluno";
}
private static String getStudentParentPhoneTitle() {
return "telefone_pai_aluno";
}
private static String getStudentParentCellphoneTitle() {
return "celular_pai_aluno";
}
private static String getStudentParentEmailTitle() {
return "email_pai_aluno";
}
}
所以,我的问题是配置 Parse。我只是放弃并开始使用 firebase,我发现它更好,因为它更容易设置,更易于使用并且有更多的文档。
我正在做一个实际上包含在 CRUD 中的应用程序。
碰巧在填写表格并保存信息后,应用程序崩溃了,我不知道为什么。
这是我得到的日志:
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded class_id=gralloc
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded name=gralloc
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded prop_name=ro.hardware.gralloc
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded for circle execute
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH2=/vendor/lib64/hw, name=gralloc, subname=mt6735
01-02 16:15:59.731 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH1=/system/lib64/hw, name=gralloc, subname=mt6735
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists return ENOENT
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH2=/vendor/lib64/hw, name=gralloc, subname=MT6737T
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH1=/system/lib64/hw, name=gralloc, subname=MT6737T
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists return ENOENT
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH2=/vendor/lib64/hw, name=gralloc, subname=mt6737t
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-hw_module_exists HAL_LIBRARY_PATH1=/system/lib64/hw, name=gralloc, subname=mt6737t
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp E/HAL: SLCODE-loaded HAL id=gralloc path=/system/lib64/hw/gralloc.mt6737t.so
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp I/[MALI][Gralloc]: [+]r_hnd(0x7f7d738220), client(27), share_fd(43)
01-02 16:15:59.732 11444-11510/com.reforcointeligente.brainstormapp D/GraphicBuffer: register, handle(0x7f7d738220) (w:720 h:1280 s:720 f:0x1 u:0x000b00)
当我调用这个方法时,应用程序崩溃了:
public void onStudentCreated() {
Student student = new Student();
EditText studentNameEditText = (EditText) findViewById(R.id.editTextStudentName);
EditText studentAgeEditText = (EditText) findViewById(R.id.editTextStudentAge);
EditText studentSchoolEditText = (EditText) findViewById(R.id.editTextStudentSchool);
EditText studentAddressEditText = (EditText) findViewById(R.id.editTextStudentAddress);
EditText studentParentNameEditText = (EditText) findViewById(R.id.editTextStudentParentName);
EditText studentParentCellphoneEditText = (EditText) findViewById(R.id.editTextStudentParentCellphone);
EditText studentParentPhoneEditText = (EditText) findViewById(R.id.editTextStudentParentPhone);
EditText studentParentEmailEditText = (EditText) findViewById(R.id.editTextStudentParentEmail);
String studentName = studentNameEditText.getText().toString();
String studentAge = studentAgeEditText.getText().toString();
String studentSchool = studentSchoolEditText.getText().toString();
String studentAddress = studentAddressEditText.getText().toString();
String studentCity = spinner.getSelectedItem().toString();
String studentParentName = studentParentNameEditText.getText().toString();
String studentParenteCellphone = studentParentCellphoneEditText.getText().toString();
String studentParentPhone = studentParentPhoneEditText.getText().toString();
String studentParentEmail = studentParentEmailEditText.getText().toString();
student.setStudentName(studentName);
student.setStudentAge(studentAge);
student.setStudentSchool(studentSchool);
student.setStudentAddress(studentAddress);
student.setStudentCity(studentCity);
student.setStudentParentName(studentParentName);
student.setStudentParentCellphone(studentParenteCellphone);
student.setStudentParentPhone(studentParentPhone);
student.setStudentParentEmail(studentParentEmail);
}
最后,这是我的模型:
@ParseClassName("Student")
public class Student extends ParseObject {
public String getStudentName() {
return getString(getStudentNameTitle());
}
public void setStudentName(String studentName) {
put(getStudentNameTitle(), studentName);
}
public String getStudentAge() {
return getString(getStudentAgeTitle());
}
public void setStudentAge(String studentAge) {
put(getStudentAgeTitle(), studentAge);
}
public String getStudentAddress() {
return getString(getStudentAddressTitle());
}
public void setStudentAddress(String studentAddress) {
put(getStudentAddressTitle(), studentAddress);
}
public String getStudentCity() {
return getString(getStudentCityTitle());
}
public void setStudentCity(String studentCity) {
put(getStudentCityTitle(), studentCity);
}
public String getStudentSchoolYear() {
return getString(getStudentSchoolYearTitle());
}
public void setStudentSchoolYear(String studentSchoolYear) {
put(getStudentSchoolYearTitle(), studentSchoolYear);
}
public String getStudentSchool() {
return getString(getStudentSchoolTitle());
}
public void setStudentSchool(String studentSchool) {
put(getStudentSchoolTitle(), studentSchool);
}
public String getStudentParentName() {
return getString(getStudentParentNameTitle());
}
public void setStudentParentName(String studentParentName) {
put(getStudentParentNameTitle(), studentParentName);
}
public String getStudentParentPhone() {
return getString(getStudentParentPhoneTitle());
}
public void setStudentParentPhone(String studentParentPhone) {
put(getStudentParentPhoneTitle(), studentParentPhone);
}
public String getStudentParentCellphone() {
return getString(getStudentParentCellphoneTitle());
}
public void setStudentParentCellphone (String studentParentCellphone) {
put(getStudentParentCellphoneTitle(), studentParentCellphone);
}
public String getStudentParentEmail() {
return getString(getStudentParentEmailTitle());
}
public void setStudentParentEmail(String studentParentEmail) {
put(getStudentParentEmailTitle(), studentParentEmail);
}
public static ParseQuery<Student> getQuery() {
return ParseQuery.getQuery(Student.class);
}
public static String getStudentNameTitle() {
return "nome_aluno";
}
private static String getStudentAgeTitle() {
return "idade_aluno";
}
private static String getStudentAddressTitle() {
return "endereco_aluno";
}
private static String getStudentCityTitle() {
return "cidade_aluno";
}
private static String getStudentSchoolYearTitle() {
return "serie_aluno";
}
private static String getStudentSchoolTitle() {
return "colegio_aluno";
}
private static String getStudentParentNameTitle() {
return "nome_pai_aluno";
}
private static String getStudentParentPhoneTitle() {
return "telefone_pai_aluno";
}
private static String getStudentParentCellphoneTitle() {
return "celular_pai_aluno";
}
private static String getStudentParentEmailTitle() {
return "email_pai_aluno";
}
}
所以,我的问题是配置 Parse。我只是放弃并开始使用 firebase,我发现它更好,因为它更容易设置,更易于使用并且有更多的文档。