lundi 13 juin 2016

How to store and read text on android project?

I'm pharmD student and newly in android development. I create an app to calculate the doses for patient upon specific calculation. now PharmD will input the data then calc.. etc. I need to make the user can save the patient case in the internal sd then in any time he need to see it can go back for it So firstly; how to store my text

EditText r11;
r11 = (EditText) findViewById(R.id.Result);
r11.setText(
                            "n------------------" +
                                    "nInputs" +
                                    "n------------------" +
                                    "nnPatient Name:" + i1 +
                                    "nGender:" + i4 +
                                    "nRace:" + i5 +
                                    "nRoom:" + i2 +
                                    "nDate:" + i3 +
                                    "nAge (years):" + n4 +
                                    "nHeight (cm):" + n5 +
                                    "nWeight (Kg):" + n6 +
                                    "nSCR (mg/dl):" + n7 +
                                    "nTau (hrs):" + n8 +
                                    "nCss Avg (mg/L):" + n9 +
                                    "nnn------------------" +
                                    "nAnalysis:" +
                                    "n------------------" +
                                    "nnIdeal Body Weight:" + r8.getText().toString() + "  Kg" +
                                    "nAdjusted body weight:" + r9.getText().toString() + "  Kg" +
                                    "nBody Surface Area:" + Html.fromHtml(r10.getText().toString() + "  m<sup><small>2</small></sup>") +
                                    "nBody Mass Index:" + Html.fromHtml(r12.getText().toString() + "  Kg/m<sup><small>2</small></sup>") +
                                    "nnn------------------" +
                                    "nDigoxin TDM :" +
                                    "n------------------" +
                                    "nnVolume of Distribution:" + r4.getText().toString() + "  L" +
                                    "nCockcroft & Gault:" + r1.getText().toString() + "  ml/min" +
                                    "nCockcroft & Gault(adjusted for BSA):" + Html.fromHtml(r2.getText().toString() + "  ml/min/1.73m<sup><small>2</small></sup>")+
                                    "nDigoxin (CrCl):" + r3.getText().toString() + "  L/day"+
                                    "nElimination Rate Constant: " + r5.getText().toString() + "  h<sup><small>-1</small></sup>"+
                                    "nHalf Life:" + r6.getText().toString() + "  hr"

                    );

Secondly ; I want to reload it or read it, so the user can find it !.

I know it is basic for android development but I respect any answer can help me in the (code)

Thanks in advance :)

Aucun commentaire:

Enregistrer un commentaire