在我的应用程序中,我正在从服务器检索记录。记录在一个 xml 文件中。我能够毫无问题地获取文件并解析它。我将结果存储在 HashMap 中,我希望能够将这些结果放入我的应用程序的 SQLite 数据库中。
这是HashMap的代码
            ArrayList<HashMap<String, String>> StudentDownloads = new ArrayList<HashMap<String, String>>();
        String xml = XMLfunctions.getXML(target);
        Document doc = XMLfunctions.XMLfromString(xml);
        if(XMLfunctions.XMLfromString(xml)==null){
            Toast.makeText(this, "Badly Formed File", Toast.LENGTH_LONG).show();  
            finish();
        }          
        int numResults = XMLfunctions.numResults(doc);
        if((numResults <= 0)){
            Toast.makeText(this, "There Were No Student Results To Show", Toast.LENGTH_LONG).show();  
            finish();
        }
        NodeList nodes = doc.getElementsByTagName("Students");
        for (int i = 0; i < nodes.getLength(); i++) {                           
            HashMap<String, String> map = new HashMap<String, String>();    
            Element e = (Element)nodes.item(i);
            map.put("Student Id", "Student Id " + XMLfunctions.getValue(e, "StudentId"));
            map.put("Student Type", "Student Type" + XMLfunctions.getValue(e, "StudentType"));
            map.put("Student Location", "Student Location" + XMLfunctions.getValue(e, "StudentLocation"));
            map.put("Student Mother", "Student Mother" + XMLfunctions.getValue(e, "StudentMother"));
            StudentDownloads.add(map);}         
        };
现在在我的应用程序中,我已经创建了一个使用名为 StudentRecord 的类的数据输入表单,在我的输入表单中,我使用此函数来更新文件
        private void addStudent(StudentRecord newRecord){
             mDB.beginTransaction();
             try {
                    ContentValues StudentRecordToAdd = new ContentValues();
                    StudentRecordToAdd.put(Students.STUDENT_ID, newRecord.getStudentName());
                    StudentRecordToAdd.put(Student.STUDENT_TYPE, newRecord.getStudentType());
                    StudentRecordToAdd.put(Student.STUDENT_LOCATION, newRecord.getStudentLocation());
                    StudentRecordToAdd.put(Student.STUDENT_MOTHER, newRecord.getStudentMother());
                    mDB.insert(Student.STUDENT_TABLE_NAME,Student.STUDENT_ANIMALID, StudentRecordToAdd);
                    mDB.setTransactionSuccessful();
                    Toast.makeText(this,"Recorded Added ",0).show();
             } finally {
                 mDB.endTransaction();
             }
将我的值从 HashMap 获取到我的 NewRecord 函数的最佳方法是什么?我看了这么久,我想我已经脑死了。谢谢